Preserve aliases if needed.
authorRafael Espindola <rafael.espindola@gmail.com>
Sat, 12 Feb 2011 18:03:13 +0000 (18:03 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sat, 12 Feb 2011 18:03:13 +0000 (18:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125439 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lto/LTOCodeGenerator.cpp

index b2554f87b59344535e1ab773d4e6cb10a2ff0346..adb7102b3c76fc35720b3e0fa992f78ff3553254 100644 (file)
@@ -367,6 +367,14 @@ void LTOCodeGenerator::applyScopeRestrictions() {
           _mustPreserveSymbols.count(Buffer))
         mustPreserveList.push_back(::strdup(v->getNameStr().c_str()));
     }
+    for (Module::alias_iterator a = mergedModule->alias_begin(),
+         e = mergedModule->alias_end(); a != e; ++a) {
+      Buffer.clear();
+      mangler.getNameWithPrefix(Buffer, a, false);
+      if (!a->isDeclaration() &&
+          _mustPreserveSymbols.count(Buffer))
+        mustPreserveList.push_back(::strdup(a->getNameStr().c_str()));
+    }
     passes.add(createInternalizePass(mustPreserveList));
   }