This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: dladdr(): adventure in ABIs, function descriptors in IA-64 and HPPA vs PPC64 ELFv1


On 6/24/19 1:36 PM, Yann Droneaud wrote:
> Hi,
> 
> In https://sourceware.org/bugzilla/show_bug.cgi?id=24561, I've
> summarized my discoveries regarding dladdr() implementation(s).
> 
> I've managed to make dladdr() works faster for generic ELF and PPC
> 64bits ELFv1.
> 
> I would like to contribute some tests for dladdr() to prove the
> optimisations produce the same results as current implementation.
> 
> Before doing so, I have to understand interaction between dladdr() and
> IA-64  and PA-Risc function descriptors.
> 
> ppc64 ELFv1 was quite simple to handle with regard to function
> descriptors (but required increasing the memory needed for the symbols
> cache).
> 
> But the two others set ELF_FUNCTION_PTR_IS_SPECIAL and rely on dl-fptr, 
> which I haven't look to much, but seem definitely less straightforward.
> As there's some linear search through a linked list, it might be useful
> I look at it.
> 
> Could someone comment why function descriptors support is so different
> between ppc64 and the other, one not using ELF_FUNCTION_PTR_IS_SPECIAL
> and the others using it ?

Andreas Schwab already commented on the bugzilla, but I'll comment here
for reference.

On ppc64 the function descriptors are in a statically allocated section
that is setup by the static linker.

On ia64 and hppa the descriptors are allocated dynamically at runtime.
 
> Unfortunately digging through the git history and looking at commit
> messages and ChangeLog was not really useful, as those at mostly being
> "captain-obvious" style descriptions of the changes, without any
> explanation, motivation, rationale for the (added) changes.

The git history, even a detailed one, would never explain all the nuances
of a particular ABI and the historical implementation choices.

The history is that the 32-bit hppa runtime had direct functions (low bit-2
not set) and function descriptors (low bit-2 set), and so you don't always
use a function descriptor. HJ Lu moved ia64 over to a new harmonized descriptor
list handling code, and likewise I ported hppa to the same routines, but then
had to clone them to make significant changes.

If you have any direct questions, please just ask. In theory I still am
the hppa maintainer, and I worked on the function pointer implementation
for hppa.

-- 
Cheers,
Carlos.


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