[LLVMdev] llvm.global_ctors and other "appending linkage" global variables?
Török Edwin
edwintorok at gmail.com
Sun Apr 11 11:04:36 PDT 2010
On 2010-04-11 20:25, David Dunkle wrote:
>
> Can anyone explain how llc translates "appending linkage" global
> variables like llvm.global_ctors into assembly? In the case I am
> examining, the global_ctor variables are in multiple bitcode object
> modules produced by the llvm compiler as arrays of pointers. As
> documented, the arrays seem to be combined when the different bitcode
> object modules are linked into one, so now there is one
> llvm.global_ctors array. But then when llc compiles the bitcode file
> into an assembly file, the llvm.global_ctor variable, or at least its
> symbol, disappears.
> In this case, the array looks like it is an array of pointers to
> functions. The functions whose addresses were in the global_ctors array
> are still present in the assembly file, but the global_ctors array
> itself seems to be gone.
It goes into a .ctors section:
.section .ctors,"aw", at progbits
.align 8
.quad foo
Best regards,
--Edwin
More information about the llvm-dev
mailing list