frv ld: don't warn for relocs to discarded linkonce section symbols
Alexandre Oliva
aoliva@redhat.com
Thu May 6 06:49:00 GMT 2004
When a relocation references a linkonce section symbol that was
discarded, the relocation is modified such that its symbol index is
zero long after we sized dynamic sections, right before we try to emit
the dynamic relocation.
Unfortunately, the code I (not really) recently added to catch cases
of emitting too many dynamic relocations for a symbol caught such an
inconsistency while building libstdc++.so for frv-uclinux.
I don't see a clean way to address this problem. We don't know the
section is going to be discarded in check_relocs, where we initially
collect the information. In size_dynamic_sections, we can't get to
the local symbol/section table of the bfd to tell whether the section
was discarded either. Then, in relocate_section, the relocation was
already modified and we can't get back the information we need to tell
which entry we should get the information from. So I'm just punting
at it and disabling the warning at this point. If it turns out that
we emit a different number of dynamic relocations than initially
estimated, we'll still get a warning.
Ideally, we'd omit the dynamic relocation (or rofixup entry) entirely,
but especially for rofixups, we really can't do that, because the
sizes of the sections have already been determined, and symbols
pointing to the beginning and end of .rofixup have already been
defined. We could omit the dynamic relocations, but the number of
dynamic relocations would have already been set as well, so we don't
gain anything.
Anyhow... Here's the patch. Ok?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd-frv-reloc-discarded-linkonce.patch
Type: text/x-patch
Size: 1631 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20040506/4b5d5a1a/attachment.bin>
-------------- next part --------------
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
More information about the Binutils
mailing list