Access to .dynamic section of executable from shared library

Konstantin Baydarov kbaidarov@ru.mvista.com
Tue Jun 12 22:47:00 GMT 2007


  Hi All.
I'm trying to get access to .dynamic section of executable in from my 
shared library. I'm using _DYNAMIC pointer. But, according to objdump 
output, it points to .dynamic section of library instead of executable.
I've made investigations an found out that every object file(executable 
of shared library) have a _DYNAMIC symbol and it's local. And when we 
using _DYNAMIC we using this local symbol. So when I'm using _DYNAMIC in 
shared library - I get pointer to .dynamic section of library, when I'm 
using _DYNAMIC in executable - I get pointer to .dynamic section of 
executable.
Is there any way to get pointer to executable _DYNAMIC from shared 
library context. Maybe when I'm building shared library I should tell 
dynamic linker to replace local _DYNAMIC with _DYNAMIC from executable. 
I've tried to assign "weak" attribute to definition of _DYNAMIC in 
library code - didn't help.
And also I didn't have this problem with gcc 3.4.3.
Any Ideas?
Thanks!



More information about the Gcc mailing list