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 ELF section header at runtime


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)

And then use symbol in your C code.

Cheers,
Carlos.


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