This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
address of function
- From: Mathieu Lacage <Mathieu dot Lacage at sophia dot inria dot fr>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 11 Jan 2005 15:16:55 +0100
- Subject: address of function
- Organization: INRIA
hi,
I recently noticed that the exact semantics of the "address of function"
operation in C seem to change slightly depending on the way I have
compiled the code of my application.
Specifically:
1) main code is built with gcc -c -o foo.o foo.c
I get address of function = address of PLT entry for this function of
the main executable
2) main code is built with gcc -fPIC -c -o foo.o foo.c
I get address of function = address of code of function.
Is there a way to tell the difference at runtime between these two
cases ? An answer might be to point me to the specific if statement in
glibc/elf/ directory which differentiates the two types of relocations:
I have been unable to identify which code does the symbol resolution for
a relocation entry of type R_386_GLOB_DAT (compilation with -fPIC) as
opposed to the case where there is no such entry.
regards,
Mathieu
--