[binutils-gdb] Remove sframe relocs against discarded sections
Alan Modra
amodra@sourceware.org
Thu Jul 17 05:48:59 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fcf7470408aa0508fbe99abb99547757a348383d
commit fcf7470408aa0508fbe99abb99547757a348383d
Author: Alan Modra <amodra@gmail.com>
Date: Thu Jul 17 14:42:31 2025 +0930
Remove sframe relocs against discarded sections
Commit d7f343eaad3f testsuite change resulted in a regression for
s390x-linux. This extends the x86_64 fix to other targets.
PR ld/33156
* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Remove .sframe
relocs too.
Diff:
---
bfd/elf-bfd.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 2bd855a936c..5af11cf6a31 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -3280,11 +3280,14 @@ extern asection _bfd_elf_large_com_section;
_bfd_clear_contents (howto, input_bfd, input_section, \
contents, rel[index].r_offset); \
\
+ /* For ld -r, remove relocations in debug and sframe sections \
+ against symbols defined in discarded sections. Not done for \
+ others. In particular the .eh_frame editing code expects \
+ such relocs to be present. */ \
if (bfd_link_relocatable (info) \
- && (input_section->flags & SEC_DEBUGGING)) \
+ && ((input_section->flags & SEC_DEBUGGING) != 0 \
+ || elf_section_type (input_section) == SHT_GNU_SFRAME)) \
{ \
- /* Only remove relocations in debug sections since other \
- sections may require relocations. */ \
Elf_Internal_Shdr *rel_hdr; \
\
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
More information about the Binutils-cvs
mailing list