This is the mail archive of the libc-help@sourceware.org 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]

Re: How to access an applications ELF program header and ELFsection header at runtime


On Fri, Oct 23, 2009 at 11:02:55AM -0400, Carlos O'Donell wrote:
> On Thu, Oct 22, 2009 at 4:49 PM, Bharath Ramesh <bramesh@vt.edu> wrote:
> > I am trying to play around with the symbols __data_start and __bss_start
> > to access the location of the .data and .bss section. Is there any way I
> > need to typecast these symbols so that I can get the information from
> > these symbols.
> 
> extern const char __symbol __attribute__((weak));
> #define symbol ((unsigned long)&__symbol)
> 

As mentioned in earlier emails to this thread [1] I need to access the
.data and .bss sections of an application. I need to access this from
the constructor of my shared library. I am not of the reason, but I am
an unable to get access to __data_start. It always has a value of NULL
address to it. I am able to get valid value for _edata, __bss_start and
_end. When I use nm to list the symbols of the application __data_start
does exist with an offset, but __data_start symbol for the shared
library doesnt have any offset. Is there something I am missing, is
there any way I can make sure that I get the valid address for these
symbols from the constructor of the shared library.

Regards,

Bharath

[1] http://sourceware.org/ml/libc-help/2009-08/msg00032.html

Attachment: smime.p7s
Description: S/MIME cryptographic signature


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