This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gold assert after "relocation refers to discarded section" warnings


Cary Coutant <ccoutant@google.com> writes:

> When we see a reference to a local symbol in a discarded COMDAT
> section, we print a warning "relocation refers to discarded section",
> and continue. Unfortunately, if the relocation happens to be one of
> the GOT relocations, we fail an assert later in Relocate::relocate()
> because no GOT offset has been assigned:


> We could soften the assert to accept this case, but should we continue
> with a got_offset of 0? Alternatively, we could print a fatal error
> message at this point, or we could just turn the earlier warning into
> an error. What do you think?

Perhaps if we get the "relocation refers to discarded section" error we
should simply skip calling relocate.relocate for that reloc.  But if we
do that we would have to make it an error.  And I'm a little reluctant
to make it an error because historically there have been acceptable .o
files with bogus relocs.  It would be better if gold continued to accept
those.

Actually, though, why is there no GOT offset assigned?  The code which
sets the GOT offset is independent of the code which notices that the
symbol is defined in a discarded section.  It seems like we should still
see the GOT reloc against the symbol.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]