[PATCH] gold: Don't adjust local symbol values in relocatable link twice
Cary Coutant
ccoutant@gmail.com
Wed Nov 8 23:16:00 GMT 2017
> The fix committed for PR gold/19291 ended up breaking other cases. The
> commit added adjustment code to write_local_symbols, but in many cases
> compute_final_local_value_internal had already subtracted the output
> section's address. To fix this, all other adjustments are now removed, so
> only the one in write_local_symbols is left.
>
> gold/
> PR gold/22266
> * object.cc (Sized_relobj_file::compute_final_local_value_internal):
> Drop relocatable parameter and stop adjusting output value based on
> it.
> (Sized_relobj_file::compute_final_local_value): Stop passing
> relocatable to compute_final_local_value_internal.
> (Sized_relobj_file::do_finalize_local_symbols): Ditto.
> * object.h (Sized_relobj_file::compute_final_local_value_internal):
> Drop relocatable parameter.
> ---
>
> A simple test is available at http://paste.debian.net/990796/, which is
> much simpler than the real-world example in PR gold/22266. You can see
> that int_from_a_1 ends up having a negative (well, large positive since
> it's unsigned) symbol value when gold is used before this patch, so the
> value printed by the program is not the expected 11223344 but whatever
> happens to be before it in memory.
Thanks! I've added the test case from the link you gave, and committed
this on your behalf.
-cary
More information about the Binutils
mailing list