This is the mail archive of the libc-alpha@sources.redhat.com 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]

address of function


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
-- 


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