Xin LIU
2009-May-23 17:00 UTC
[LLVMdev] why RegisterPass<TargetData> initialize itself twice in my system
HI, Developers: I linked libLTO.so in $LLVMROOT/Debug/lib however, my program crashes in assertion at 149line [Pass.cpp] void RegisterPass(const PassInfo &PI) { bool Inserted PassInfoMap.insert(std::make_pair(PI.getTypeInfo(),&PI)).second; assert(Inserted && "Pass registered multiple times!"); } i confirm that there is only one static variable suspecting to call this register routine to register "TargetData" Pass in L35 [TargetData.cpp] // Register the default SparcV9 implementation... static RegisterPass<TargetData> X("targetdata", "Target DataLayout", false, true); but back track things before main entry, i got actually twice same intializations: the attached is bt using gdb, why this happens? My system is x86_64 in linux-Fedora 7. Is that okay i remove the asssert stmt to use it? -------------- next part -------------- ;; 1st PassInfo (this=0x2aaaac3472a0, name=0x2aaaabe24421 "Target Data Layout", arg=0x2aaaabe24434 "targetdata", pi=17004736, normal=0xada74e <llvm::Pass* llvm::callDefaultCtor<llvm::TargetData>()>, isCFGOnly=false, is_analysis=true) at /home/xliu/dev/llvm/include/llvm/PassSupport.h:59 (gdb) bt #0 PassInfo (this=0x2aaaac3472a0, name=0x2aaaabe24421 "Target Data Layout", arg=0x2aaaabe24434 "targetdata", pi=17004736, normal=0xada74e <llvm::Pass* llvm::callDefaultCtor<llvm::TargetData>()>, isCFGOnly=false, is_analysis=true) at /home/xliu/dev/llvm/include/llvm/PassSupport.h:59 #1 0x0000000000ada6f1 in RegisterPass (this=0x2aaaac3472a0, PassArg=0x2aaaabe24434 "targetdata", Name=0x2aaaabe24421 "Target Data Layout", CFGOnly=false, is_analysis=true) at /home/xliu/dev/llvm/include/llvm/PassSupport.h:168 #2 0x00002aaaabb0e528 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at TargetData.cpp:36 #3 0x00002aaaabb0e57b in global constructors keyed to _ZN4llvm10TargetData2IDE () at TargetData.cpp:604 #4 0x00002aaaabc0cb86 in __do_global_ctors_aux () from /usr/local/lib64/libLTO.so #5 0x00002aaaab0f33d3 in _init () from /usr/local/lib64/libLTO.so #6 0x00002aaaac34a4b0 in ?? () #7 0x0000003e9f60d11b in call_init () from /lib64/ld-linux-x86-64.so.2 #8 0x0000003e9f60d225 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2 #9 0x0000003e9f600a9a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2 #10 0x0000000000000001 in ?? () #11 0x0000000000000000 in ?? () ;; 2nd call stack (gdb) bt #0 PassInfo (this=0x10378e0, name=0xc75921 "Target Data Layout", arg=0xc75934 "targetdata", pi=17004736, normal=0xada74e <llvm::Pass* llvm::callDefaultCtor<llvm::TargetData>()>, isCFGOnly=false, is_analysis=true) at /home/xliu/dev/llvm/include/llvm/PassSupport.h:59 #1 0x0000000000ada6f1 in RegisterPass (this=0x10378e0, PassArg=0xc75934 "targetdata", Name=0xc75921 "Target Data Layout", CFGOnly=false, is_analysis=true) at /home/xliu/dev/llvm/include/llvm/PassSupport.h:168 #2 0x0000000000ad7df4 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at TargetData.cpp:36 #3 0x0000000000ad7e47 in global constructors keyed to _ZN4llvm10TargetData2IDE () at TargetData.cpp:604 #4 0x0000000000ae7cf6 in __do_global_ctors_aux () #5 0x00000000005f9bfb in _init () #6 0x00007fff854b8c98 in ?? () #7 0x0000000000ae7c77 in __libc_csu_init () #8 0x0000003e9fa1da4e in __libc_start_main () from /lib64/libc.so.6 #9 0x00000000005fb1c9 in _start ()