Re: -z preinitarray

From: Seongbae Park (Seongbae.Park_at_Sun.COM)
Date: 04/29/05


Date: Fri, 29 Apr 2005 15:33:01 +0000 (UTC)

Dan Koren <dankoren@yahoo.com> wrote:
>
>
> I tried moving one of the initialization functions in a
> shared library to the preinitialization section, using
> the -z preinitarray ld option, and now it is no longer
> called!
>
> I am wondering what might cause this behavior. According
> to the linker manual, a function specified in this ld
> option is moved into the preinitialization section, and
> if a preinitialization section does not already exist,
> one would be created.
>
> What am I missing? Any advice would be greatly appreciated.
>
> Thx,
>
>
> dk

>From S10 Linker and Libraries Guide:

    A dynamic executable can provide pre-initialization functions in a
              ^^^^^^^^^^
    .preinit_array section. These functions are executed after the runtime
    linker has built the process image and performed relocations but
    before any other initialization functions. Pre-initialization functions are
    not permitted in shared objects.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In short, preinit_array doesn't work in shared object.

-- 
#pragma ident "Seongbae Park, compiler, http://blogs.sun.com/seongbae/"


Relevant Pages

  • Re: -z preinitarray
    ... >> shared library to the preinitialization section, ... > From S10 Linker and Libraries Guide: ... > before any other initialization functions. ...
    (comp.unix.solaris)
  • -z preinitarray
    ... I tried moving one of the initialization functions in a ... shared library to the preinitialization section, ... Thx, ...
    (comp.unix.solaris)