]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
bfd: ld: sframe: set SEC_EXCLUDE when discarding SFrame sections users/ibhagat/try-pr33127-v1
authorIndu Bhagat <indu.bhagat@oracle.com>
Sun, 13 Jul 2025 13:22:54 +0000 (06:22 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Sun, 13 Jul 2025 21:54:39 +0000 (14:54 -0700)
commit2bb9b8813667f40396be429639ecc1b636a726c1
tree40d4d0863324eb389ed174db35ed267c08267b0f
parent6a959b127014b262bb62b9fd31fd4d1f4ce4777f
bfd: ld: sframe: set SEC_EXCLUDE when discarding SFrame sections

Fix PR libsframe/33127 "ld -r" doesn't remove the sframe relocation
against the discarded section

When an SFrame section is marked for deletion, set its section size to
zero.  And mark it with SEC_EXCLUDE.

Using the testcase provided by H.J. Lu.

bfd/
PR ld/33127
* elf-sframe.c: Set section size to 0 if all FDEs are to be
deleted.  While at it, keep the rawsize updated.
* elflink.c (bfd_elf_discard_info): Set SEC_EXCLUDE to mark for
exclusion from final link.
ld/
PR ld/33127
* testsuite/ld-x86-64/sframe-reloc-2.d: New test.
* testsuite/ld-x86-64/x86-64.exp: Run sframe-reloc-2.
bfd/elf-sframe.c
bfd/elflink.c
ld/testsuite/ld-x86-64/sframe-reloc-2.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp