This is the mail archive of the binutils@sources.redhat.com 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: how to force C++ objects to an address? (ABI issue B-7)


Jakub Jelinek <jakub@redhat.com> writes:

> Why do you need any new program header types?
> If a shared library has non-zero base VMA (first PT_LOAD segment's p_vaddr),
> ld.so will attempt to mmap at that address and only use different address
> if that range was already occupied by something else.
> Current glibc behavior is:
> 1) if binary is not position independent executable (PIE) and
>    LD_USE_LOAD_BIAS is not set in the environment, p_vaddr will be honored
>    if mmap succeeds
> 2) if binary is PIE and LD_USE_LOAD_BIAS is not set in the environment, p_vaddr
>    will not be honored
> 3) if LD_USE_LOAD_BIAS=1 is in the environment, p_vaddr will be honored
> 4) if LD_USE_LOAD_BIAS=0 is in the environment, p_vaddr will not be honored

That's a nice feature.  Where is it documented?

> But, the problem is that if you want to share the same memory image between
> several programs, you must ensure that all relocations in that shared
> library must resolve to the same addresses, i.e. also all libraries that
> shared library ever uses (including unintentional symbol interposition)
> must have the same load addresses.

For this application, it's not necessary to share the same memory
image between the programs.  It's only necessary that all the vtable
functions appear at the same virtual address for all programs.

Ian


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