diff gen/toobj.cpp @ 250:fc9c1a0eabbd trunk

[svn r267] Fixed debug info for global variables. Cleaned up the debug info code in general.
author lindquist
date Wed, 11 Jun 2008 20:53:26 +0200
parents 890b4862ec6c
children 2f2d7c843e5d
line wrap: on
line diff
--- a/gen/toobj.cpp	Tue Jun 10 21:44:04 2008 +0200
+++ b/gen/toobj.cpp	Wed Jun 11 20:53:26 2008 +0200
@@ -130,6 +130,12 @@
     // do this again as moduleinfo might have pulled something in!
     DtoEmptyAllLists();
 
+    // emit usedArray
+    const LLArrayType* usedTy = LLArrayType::get(getVoidPtrType(), ir.usedArray.size());
+    LLConstant* usedInit = LLConstantArray::get(usedTy, ir.usedArray);
+    LLGlobalVariable* usedArray = new LLGlobalVariable(usedTy, true, LLGlobalValue::ExternalLinkage, usedInit, "llvm.used", ir.module);
+    usedArray->setSection("llvm.metadata");
+
     // verify the llvm
     if (!global.params.novalidate) {
         std::string verifyErr;
@@ -574,9 +580,6 @@
             DtoConstInitGlobal(this);
         else
             gIR->constInitList.push_back(this);
-
-        if (global.params.symdebug && _linkage != llvm::GlobalValue::ExternalLinkage)
-            DtoDwarfGlobalVariable(gvar, this);
     }
 
     // inside aggregate declaration. declare a field.