This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How to get ELF auxiliary vector address outside of main(), not using **argv nor **envp?
- From: Ryan Arnold <ryan dot arnold at gmail dot com>
- To: Igor Zhbanov <izh1979 at gmail dot com>
- Cc: libc-help at sourceware dot org
- Date: Thu, 23 Apr 2009 09:59:06 -0500
- Subject: Re: How to get ELF auxiliary vector address outside of main(), not using **argv nor **envp?
- References: <f44001920904230741n66f2df0amdb31b68a9ad5add8@mail.gmail.com>
Hi Igor, there's an example in one of the libc test cases that I
wrote. My team member Sean Curry wrote the original auxv query code.
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=glibc
Look at the query_auxv() function.
Uli doesn't want the auxv information exported from GLIBC so this is
the suggested method.
We have a special library called libauxv to help with this but we
haven't released it yet. I really should get on it.
Ryan
On Thu, Apr 23, 2009 at 9:41 AM, Igor Zhbanov <izh1979@gmail.com> wrote:
> Hello!
>
> I need to read ELF auxiliary vector in my library. To do this, I use
> global pointer **environ.
> But after setenv() call, environment variables are relocated, so I
> can't use **environ anymore.
>
> And I don't know, how to get **argv outside of main() in my library.
>
> Is there any exported glibc variables that points to original argv,
> envp or auxv values?
> Or is there any reliable way to get ELF auxiliary vector?
>
> Thanks.
>