This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Don't relax undefined symbols on ppc.
- From: Douglas B Rupp <rupp at adacore dot com>
- To: Binutils <binutils at sourceware dot org>
- Cc: Alan Modra <amodra at gmail dot com>
- Date: Mon, 9 Jul 2018 13:58:33 -0700
- Subject: Don't relax undefined symbols on ppc.
Greetings,
For RTPs on ppc-vx7, we use ld --relax to avoid having to use -mlongcall
which has been found to cause extreme code bloat.
Since our Ada code doesn't always play friendly with the WRS tool chain
w.r.t exception handling, we first do a partial link of the Ada objects,
GNAT RTL, and our libgcc.
This partially linked output .o will contain undefined symbols
referencing WRS libraries of course, which are resolved during final link.
There is a problem with --relax in the partial link trying to relax the
undefined symbols, leading to the RTP failing at startup with signal 11.
I solicit comments on the attached patch, which causes undefined symbols
to be ignored during the relax process. Leaving them to be relaxed and
resolved during the final link.
--Douglas Rupp
AdaCore
diff --git bfd/elf32-ppc.c bfd/elf32-ppc.c
index 5e9251b..397c73d 100644
--- bfd/elf32-ppc.c
+++ bfd/elf32-ppc.c
@@ -7597,6 +7597,11 @@ ppc_elf_relax_section (bfd *abfd,
continue;
}
+ /* Leave undefined symbols alone. */
+ if ((tsec->output_section == bfd_und_section_ptr)
+ && bfd_link_relocatable (link_info))
+ continue;
+
/* Look for an existing fixup to this address. */
for (f = branch_fixups; f ; f = f->next)
if (f->tsec == tsec && f->toff == toff)