libc initialization and GCC's constructor with priority attribute

Mike Frysinger vapier@gentoo.org
Wed Sep 16 17:26:00 GMT 2015


On 14 Sep 2015 11:17, Václav Haisman wrote:
> I am trying to use the `__attribute__ ((__constructor__ ((prio))))`
> GCC attribute to initialize my library early, if possible. What
> concerns me is that I do not know what what priority I can safely use
> so that libc is reliably initialized before my library, for obvious
> reasons. So, the question is, at what priority is libc itself
> initialized in the terms of this attribute?

i thought this was documented somewhere, but i guess it's only
indirectly so through compile-time warnings.  as long as you use
a prio >= 101 (so values 0 through 100 are reserved), you should
be fine.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/libc-help/attachments/20150916/c3600bb4/attachment.sig>


More information about the Libc-help mailing list