[PATCH] [ELF] Make -init/-fini options compatible with the gnu linker

Simon Atanasyan simon at atanasyan.com
Tue Dec 9 04:53:47 PST 2014


>>! In D6578#6, @shankar.easwaran wrote:
> What's the right behaviour for static linking ?

These options do not affect static linking. Please correct me if I make a mistake. Here is a quote from the ld manpage:
  -init=name
  When creating an ELF executable or shared object, call NAME when the executable or shared object is loaded,
  by setting DT_INIT to the address of the function. By default, the linker uses _init as the function to call.

As far as I remember (that was five years ago or so) SunOS linker had `-z initarray=<symbol>` command line option. This option adds symbol to the `.initarray` section. We can do something like that if necessary.

http://reviews.llvm.org/D6578






More information about the llvm-commits mailing list