David Dunkle
2010-Apr-11 17:25 UTC
[LLVMdev] llvm.global_ctors and other "appending linkage" global variables?
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>
Török Edwin
2010-Apr-11 18:04 UTC
[LLVMdev] llvm.global_ctors and other "appending linkage" global variables?
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
Seemingly Similar Threads
- [LLVMdev] Best way to clean up empty global_ctors
- [LLVMdev] Appending linkage
- [LLVMdev] Inconsistent third field in global_ctors (was Re: [llvm] r214321 - UseListOrder: Visit global values)
- [LLVMdev] Inconsistent third field in global_ctors (was Re: [llvm] r214321 - UseListOrder: Visit global values)
- [LLVMdev] Inconsistent third field in global_ctors (was Re: [llvm] r214321 - UseListOrder: Visit global values)