gold assert after "relocation refers to discarded section" warnings

Ian Lance Taylor iant@google.com
Thu Oct 6 00:01:00 GMT 2011


Cary Coutant <ccoutant@google.com> writes:

> I spoke too soon. For relocations against local symbols, we ignore the
> relocation if the section is discarded:

Huh.  OK.

> I'm thinking for the case where the relocation refers to a non-BITS
> section, we should print a fatal message here; it means the file is
> corrupt and there's no point in completing the link. (We could make it
> an error instead, to diagnose all the problems instead of just the
> first, as we shouldn't get into trouble until the second pass.)

Sure, it should be an error.

> For relocations to local symbols that really are in discarded COMDAT
> sections, I think we do need to relax the assert in
> Relocate::relocate().

I'm not comfortable with simply relaxing the assert, as it would be
really bad if we let a symbol slip through without creating a GOT
offset.  Perhaps we should just pass another parameter to
relocate.relocate indicating that the reloc is known to be erroneous.

> BTW, the first FIXME above is probably dead -- we now warn later in
> relocate_section(). And the second FIXME is also taken care of there
> with Sized_relobj_file::map_to_kept_section(). OK with you if I remove
> those FIXMEs?

Sure, thanks.

Ian



More information about the Binutils mailing list