Named local symbols in the ELF dynamic symbol table
Florian Weimer
fweimer@redhat.com
Wed Dec 14 21:53:09 GMT 2022
* H. J. Lu:
> On Tue, Dec 6, 2022 at 9:11 AM Florian Weimer via Binutils
> <binutils@sourceware.org> wrote:
>>
>> The symbol table of /lib/ld-linux-ia64.so.2 starts like this:
>>
>> Symbol table [ 3] '.dynsym' contains 65 entries:
>> 33 local symbols String table: [ 4] '.dynstr'
>> Num: Value Size Type Bind Vis Ndx Name
>> 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF
>> 1: 00000000000318c0 160 FUNC LOCAL DEFAULT 10 _dl_error_free
>> 2: 00000000000234c0 16 FUNC LOCAL DEFAULT 10 __GI__dl_debug_state
>> 3: 0000000000029f80 368 FUNC LOCAL DEFAULT 10 _dl_tls_get_addr_soft
>> 4: 000000000002be00 1728 FUNC LOCAL DEFAULT 10 _dl_open
>> 5: 0000000000001550 64 FUNC LOCAL DEFAULT 10 _start
>> 6: 0000000000031540 784 FUNC LOCAL DEFAULT 10 _dl_runtime_profile
>> 7: 0000000000031440 208 FUNC LOCAL DEFAULT 10 _dl_runtime_resolve
>> 8: 00000000000312c0 384 FUNC LOCAL DEFAULT 10 _dl_close
>> 9: 0000000000018240 10720 FUNC LOCAL DEFAULT 10 _dl_lookup_symbol_x
>> 10: 000000000003ab40 80 FUNC LOCAL DEFAULT 10 _rtld_catch_error
>>
>> The interesting aspect is that these symbols are named, but are not
>> covered by the GNU_HASH table (because they are local).
>>
>> Is there a way to get the same effect on other targets? I want to
>> preserve the names of the functions that IFUNC resolvers return,
>> eventually improving diagnostics around IFUNC resolution. It would best
>> if I wouldn't have to bloat the entire symbol table for that.
>>
>
> Are you interested in R_X86_64_IRELATIVE symbols or something
> else?
Not particularly. For ld.so --list-diagnostics, I want to iterate
through .dynsym, call all IFUNC resolvers, and report the results (for
libc, libm, libmvec at least). To make the IFUNC resolver *result* more
meaningful, I want to map back the addresses to symbols like
__memmove_avx_unaligned_erms, but at the same time, I do not want to
make the symbol name __memmove_avx_unaligned_erms available for symbol
binding. A local symbol in .dynsym would be a good fit here.
We can do this for IRELATIVE relocations, too, but it might be less
beneficial.
Thanks,
Florian
More information about the Binutils
mailing list