Don't create .eh_frame_hdr on shared lib bfd
Alan Modra
amodra@gmail.com
Wed Dec 24 12:01:00 GMT 2014
If no object files have .eh_frame, but some shared library does, then
ld creates a .eh_frame_hdr section using the shared library bfd. This
is silly since shared library .eh_frame sections don't contribute to
the output .eh_frame and thus no .eh_frame_hdr is needed.
Also, the bfd section list and count is cleared for shared libraries,
and a zero section count used as a flag in lang_check to omit a call
to bfd_merge_private_bfd_data for shared libraries. If we create a
section on a shared lib bfd then ld will wrongly attempt to merge the
shared library private bfd data.
It looks like I've missed getting this into 2.25, but I'll put this on
the branch after Tristan announces the release.
PR 17742
* ld/emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude
shared libraries in loop looking for .eh_frame sections.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 137446f..d49ff2b 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1053,6 +1053,8 @@ gld${EMULATION_NAME}_after_open (void)
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
{
+ if (bfd_count_sections (abfd) == 0)
+ continue;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
elfbfd = abfd;
if (!warn_eh_frame)
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list