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: [PATCH] PR ld/21233: Avoid sweeping forced-undefined symbols in section GC


On Mon, Mar 27, 2017 at 12:39:07PM +0100, Maciej W. Rozycki wrote:
> 	PR ld/21233
> 	* ldlang.c (insert_undefined): Set `mark' for ELF symbols.
> 	* testsuite/ld-elf/pr21233.sd: New test.
> 	* testsuite/ld-elf/pr21233-l.sd: New test.
> 	* testsuite/ld-elf/pr21233.ld: New test linker script.
> 	* testsuite/ld-elf/pr21233-e.ld: New test linker script.
> 	* testsuite/ld-elf/pr21233.s: New test source.
> 	* testsuite/ld-elf/pr21233-l.s: New test source.
> 	* testsuite/ld-elf/shared.exp: Run the new tests.

OK.

[snip]
>  I have identified the cause of this phenomenon to be the reverse order 
> `elf_gc_sweep' and `_bfd_elf_link_check_relocs' are called in on these 
> targets, causing `->non_got_ref' to be set for the symbol even though the 
> reference is later discarded.  The possibility to change the order has 
> been introduced with commit d968975277ba ("Check ELF relocs after opening 
> all input files"), using CHECK_RELOCS_AFTER_OPEN_INPUT, after a discussion 
> started at <https://www.sourceware.org/ml/binutils/2016-04/msg00295.html> 
> which indicates the intent to gradually swap the order for all targets. 
> After the initial change for x86 this has only been since done for SH (cf 
> PR ld/17739), i.e. I gather we are still in the middle of the move.

Well, powerpc hasn't changed where check_relocs is called, so this
isn't the whole story.  ie. The powerpc backend code shows that it is
possible to get this case right without delaying check_relocs.

>  Which brings me a question to our general maintainers: which of the 
> following 3 options shall I pick for the purpose of this test case:
> 
> 1. Leave the new failures as they are and let maintainers handle them as
>    they find need or time; there may be more to be done for individual
>    targets beyond the lone change to CHECK_RELOCS_AFTER_OPEN_INPUT.

Like this, I think.  Your testcase demonstrate a bug in the affected
backends.  Best make it visible.

-- 
Alan Modra
Australia Development Lab, IBM


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