[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-secti
From: |
nelsonc1225 at sourceware dot org |
Subject: |
[Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections |
Date: |
Mon, 27 Dec 2021 11:46:40 +0000 |
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.
- [Bug ld/28709] New: [RISC-V] a unused section can't be removed with -gc-sections, address@hidden, 2021/12/17
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, amodra at gmail dot com, 2021/12/20
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, amodra at gmail dot com, 2021/12/20
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, amodra at gmail dot com, 2021/12/20
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, lifang_xia at linux dot alibaba.com, 2021/12/21
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, nelsonc1225 at sourceware dot org, 2021/12/27
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections,
nelsonc1225 at sourceware dot org <=
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, cvs-commit at gcc dot gnu.org, 2021/12/28
- [Bug ld/28709] [RISC-V] a unused section can't be removed with -gc-sections, lifang_xia at linux dot alibaba.com, 2021/12/28