This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gold: Don't adjust local symbol values in relocatable link twice
- From: Cary Coutant <ccoutant at gmail dot com>
- To: James Clarke <jrtc27 at jrtc27 dot com>
- Cc: Binutils <binutils at sourceware dot org>, Ben Gamari <bgamari at gmail dot com>
- Date: Wed, 8 Nov 2017 15:16:01 -0800
- Subject: Re: [PATCH] gold: Don't adjust local symbol values in relocatable link twice
- Authentication-results: sourceware.org; auth=none
- References: <20171014231353.18724-1-jrtc27@jrtc27.com>
> 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