[LLVMdev] [lld] Handling multiple -init/-fini command line options

Joerg Sonnenberger joerg at britannica.bec.de
Mon Dec 8 09:09:15 PST 2014

On Mon, Dec 08, 2014 at 10:21:49AM -0600, Shankar Easwaran wrote:
> The DT_INIT/DT_FINI correspond to one initializer function,where as
> DT_INIT_ARRAY/DT_FINI_ARRAY is used when there is more than one
> initalizer function/finalizer function respectively.

This is not true. The difference is that the DT_INIT / DT_FINI function
is responsible for calling into the .init / .fini block and for
DT_INIT_ARRAY / DT_FINI_ARRAY, the block is explicitly defined as a
list of pointers and it is the responsibility of either the CRT logic or
the dynamic linker to call them.

That said, I don't think more than one DT_INIT / DT_FINI entry should be
allowed as the latter entry will overwrite the earlier ones.


More information about the llvm-dev mailing list