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?
On Mon, Apr 27, 2009 at 11:09 AM, Igor Zhbanov <izh1979@gmail.com> wrote:
> 2009/4/27 Carlos O'Donell <carlos@systemhalted.org>:
>> On Mon, Apr 27, 2009 at 5:02 AM, Igor Zhbanov <izh1979@gmail.com> wrote:
>>> But what if constructor of another library (which was called before
>>> my) calls setenv()?
>>
>> Set the priority of your constructor such that it executes first.
>>
>> A robust solution to your problem may be difficult to achieve.
>
> Yes. I agree that it is difficult. :-) I even thought about tracing
> the stack from the bottom. ;-)
>
> By the way, how to set priority of constructor?
>
> I need constructor of my library (shared or static) to be called first,
> so constructors of other libraries cannot call setenv() before I save
> the value of *environ.
http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Function-Attributes.html#Function-Attributes
Cheers,
Carlos.