This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How to access an applications ELF program header and ELF section header at runtime
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Bharath Ramesh <bramesh at vt dot edu>
- Cc: Eduardo <erocha dot ssa at gmail dot com>, libc-help at sourceware dot org
- Date: Fri, 23 Oct 2009 11:02:55 -0400
- Subject: Re: How to access an applications ELF program header and ELF section header at runtime
- References: <017801ca2021$2bbf3000$833d9000$@edu> <68723fbe0908181959x957e72ei13602dc3993283d5@mail.gmail.com> <01cb01ca2086$c004ffa0$400efee0$@edu> <119aab440908190539t5a14703auf8763d849ccac6e2@mail.gmail.com> <01d601ca20d2$4d005990$e7010cb0$@edu> <119aab440908190849k5bb34588h8abe4744a5b99472@mail.gmail.com> <022301ca20e5$e64fa7a0$b2eef6e0$@edu> <68723fbe0908190914v75788869ufd28677bcd49c258@mail.gmail.com> <20091022204927.GA27865@vt.edu>
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.