[LLVMdev] llvm.global_ctors and other "appending linkage" global variables?

David Dunkle ddunkle at arxan.com
Sun Apr 11 10:25:00 PDT 2010


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. Or perhaps it is translated to another data
structure that I do not recognize in the assembly file. I have found a
couple of other "appending linkage" variables that are also not present
as a symbol in the assembly file. They all seem to be special cases, I
think.
 
Does llc always remove "appending linkage" global variable symbols when
translating to assembly language? If not, can anyone explain when these
variables are added to the assembly language file and when they are not?
 
thanks,
-David
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100411/56c4e17c/attachment.html>


More information about the llvm-dev mailing list