Subject: Re: ld.elf_so and hppa
To: None <eeh@netbsd.org>
From: Matt Fredette <fredette@theory.lcs.mit.edu>
List: tech-userlevel
Date: 07/01/2002 15:07:30
> | /*
> |  * This allocates a PLABEL.  If called with a non-NULL def, the
> |  * plabel is for the function associated with that definition  
> |  * in the defining object defobj, plus the given addend.  If
> |  * called with a NULL def, the plabel is for the function at
> |  * the (unrelocated) address in addend in the object defobj.
> |  */
> | Elf_Addr _rtld_alloc_plabel(const Obj_Entry *defobj, const Elf_Sym *def,
> |     Elf_Addr addend);
> 
> I don't quite understand.  Are you allocating an actual PLABEL
> (2 memory words) inside this function?  

In the HPPA version, a list of outstanding PLABELs is kept.  If one 
doesn't already exist for a function, a new one is allocated.

> What are you allocating it from?   

In general, the HPPA version uses rtld.h's NEW macro.  (There is 
a small pool of preallocated PLABELs used while relocating the
linker itself; I was hesitant to use NEW during that time.)

> Where does it get freed if the library is unloaded?

Right now they don't get freed.  While I can't put my finger on it,
something makes me think that keeping them around is a good idea.
How good/bad is the overhead of the allocator behind NEW?

> | /*              
> |  * If a pointer is a PLABEL, this unwraps it and returns the
> |  * function's true address.
> |  */ 
> | const void *_rtld_unwrap_plabel(const void *addr);
> 
> This is a very poor choice in name since it doesn't really give
> much idea what it does.  I'd recommend something like
> "_rtld_plabel_function" instead.

OK.  So how about:

_rtld_plabel_alloc
_rtld_plabel_function

Matt

-- 
Matt Fredette