This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 1/2] Update _bfd_elf_symbol_refs_local_p/add UNDEFINED_WEAK_RESOLVED_TO_ZERO
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Sun, 8 Oct 2017 19:26:36 -0700
- Subject: Re: [PATCH 1/2] Update _bfd_elf_symbol_refs_local_p/add UNDEFINED_WEAK_RESOLVED_TO_ZERO
- Authentication-results: sourceware.org; auth=none
- References: <20171007002908.GA31964@gmail.com> <20171009010140.GM3413@bubble.grove.modra.org>
On 10/8/17, Alan Modra <amodra@gmail.com> wrote:
> On Fri, Oct 06, 2017 at 05:29:08PM -0700, H.J. Lu wrote:
>> Update _bfd_elf_symbol_refs_local_p to cache result
>
> Caching the result is a really bad idea. It's not as if the function
> is anywhere near the top of any profiling result, and to cache return
> value you need to be sure that the return value won't change between
> the first call and the last in every target. That isn't true, as even
> a cursory examination of the code in _bfd_elf_symbol_refs_local_p
> should reveal. forced_local changes in many places!
You are right. This only works with
CHECK_RELOCS_AFTER_OPEN_INPUT=yes
which should also speedup check_relocs and GC. It should be set
for all ELF targets.
>> and handle undefined
>> weak symbols and check version script.
>
> You don't say why this is necessary. I suspect it's just one of the
> cases where you discovered that forced_local changes.
Yes, this needed by x86 convert_load_reloc, which runs during
check_relocs. That is the only problem that forced_local changes
after check_relocs with
CHECK_RELOCS_AFTER_OPEN_INPUT=yes
> You also didn't justify moving zero_undefweak to the generic elf
> flags.
>
This is also used by sparc:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b25a5c8f7a7c8b58939fe1e8cceffbad74db2af4
A single UNDEFINED_WEAK_RESOLVED_TO_ZERO is better
than 3.
--
H.J.