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 1/2] Update _bfd_elf_symbol_refs_local_p/add UNDEFINED_WEAK_RESOLVED_TO_ZERO


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.


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