https://sourceware.org/bugzilla/show_bug.cgi?id=28709
--- Comment #5 from Nelson Chu <nelsonc1225 at sourceware dot org> --- (In reply to lifang_xia from comment #3) > The riscv backend will create a reloc named BFD_RELOC_RISCV_CFA in > riscv_pre_output_hook. The reloc depends on the symbol to(.L0) and > from(.L0). > > And riscv backend will convert BFD_RELOC_RISCV_CFA to R_RISCV_SET6 and > R_RISCV_SUB6 in md_apply_fix. Each FDE is start from a R_RISCV_32_PCREL relocation, which is used to make sure the correctness of DW_CFA_advance_loc after relaxations. I think ld assumes that the relocation are generated in the FDE r_offset order, so if we have any out of order relocation, then we may accidentally remark the FDE sections that we have decided to be discarded before. According to your example, there is not only the .text.test111111 FDE needs BFD_RELOC_RISCV_CFA, the .text._Z41__static_initialization_and_destruction_0ii and .text._GLOBAL__sub_I__ZN3Box3getEv also need the BFD_RELOC_RISCV_CFA, so I figured this shouldn't be the root cause that let gc-section failed. I think if we have any out of order relocation in the eh_frame, then we may also invalidate gc-sections. -- You are receiving this mail because: You are on the CC list for the bug.