bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Function address incorrectly resolved in ld.so?


From: Joakim Tjernlund
Subject: Function address incorrectly resolved in ld.so?
Date: Thu, 5 Feb 2004 14:10:21 +0100

In Appendix, page A-11 of the TIS ELF 1.2 spec( 
http://x86.ddj.com/ftp/manuals/tools/elf.pdf )it says:

Function Addresses

References to the address of a function from an executable file and the shared 
objects associated
with it might not resolve to the same value. References from within shared 
objects will normally
be resolved by the dynamic linker to the virtual address of the function 
itself. References from
within the executable file to a function defined in a shared object will 
normally be resolved by
the link editor to the address of the procedure linkage table entry for that 
function within the
executable file.
To allow comparisons of function addresses to work as expected, if an 
executable file references
a function defined in a shared object, the link editor will place the address 
of the procedure
linkage table entry for that function in its associated symbol table entry. 
[See "Symbol Values''
in Chapter 1]. The dynamic linker treats such symbol table entries specially. 
If the dynamic
linker is searching for a symbol, and encounters a symbol table entry for that 
symbol in the
executable file, it normally follows the rules below.

  1. If the st_shndx member of the symbol table entry is not SHN_UNDEF, the 
dynamic linker has
     found a definition for the symbol and uses its st_value member as the 
symbol's address.
  2. If the st_shndx member is SHN_UNDEF and the symbol is of type STT_FUNC and 
the
     st_value member is not zero, the dynamic linker recognizes this entry as 
special and uses the
     st_value member as the symbol's address.
  3. Otherwise, the dynamic linker considers the symbol to be undefined within 
the executable file
     and continues processing.

I looked into elf/do-lookup.h and I can't see that ld.so handles the second(2) 
case. Is
this a bug or did I miss something?

    Jocke




reply via email to

[Prev in Thread] Current Thread [Next in Thread]