summaryrefslogtreecommitdiff
path: root/lib/LTO/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LTO/LTOCodeGenerator.cpp')
-rw-r--r--lib/LTO/LTOCodeGenerator.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp
index 3abb6238b3..e35e33666e 100644
--- a/lib/LTO/LTOCodeGenerator.cpp
+++ b/lib/LTO/LTOCodeGenerator.cpp
@@ -310,6 +310,7 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
void LTOCodeGenerator::
applyRestriction(GlobalValue &GV,
std::vector<const char*> &MustPreserveList,
+ std::vector<const char*> &DSOList,
SmallPtrSet<GlobalValue*, 8> &AsmUsed,
Mangler &Mangler) {
SmallString<64> Buffer;
@@ -319,6 +320,8 @@ applyRestriction(GlobalValue &GV,
return;
if (MustPreserveSymbols.count(Buffer))
MustPreserveList.push_back(GV.getName().data());
+ if (DSOSymbols.count(Buffer))
+ DSOList.push_back(GV.getName().data());
if (AsmUndefinedRefs.count(Buffer))
AsmUsed.insert(&GV);
}
@@ -348,17 +351,18 @@ void LTOCodeGenerator::applyScopeRestrictions() {
NULL);
Mangler Mangler(MContext, TargetMach);
std::vector<const char*> MustPreserveList;
+ std::vector<const char*> DSOList;
SmallPtrSet<GlobalValue*, 8> AsmUsed;
for (Module::iterator f = mergedModule->begin(),
e = mergedModule->end(); f != e; ++f)
- applyRestriction(*f, MustPreserveList, AsmUsed, Mangler);
+ applyRestriction(*f, MustPreserveList, DSOList, AsmUsed, Mangler);
for (Module::global_iterator v = mergedModule->global_begin(),
e = mergedModule->global_end(); v != e; ++v)
- applyRestriction(*v, MustPreserveList, AsmUsed, Mangler);
+ applyRestriction(*v, MustPreserveList, DSOList, AsmUsed, Mangler);
for (Module::alias_iterator a = mergedModule->alias_begin(),
e = mergedModule->alias_end(); a != e; ++a)
- applyRestriction(*a, MustPreserveList, AsmUsed, Mangler);
+ applyRestriction(*a, MustPreserveList, DSOList, AsmUsed, Mangler);
GlobalVariable *LLVMCompilerUsed =
mergedModule->getGlobalVariable("llvm.compiler.used");
@@ -386,7 +390,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
LLVMCompilerUsed->setSection("llvm.metadata");
}
- passes.add(createInternalizePass(MustPreserveList));
+ passes.add(createInternalizePass(MustPreserveList, DSOList));
// apply scope restrictions
passes.run(*mergedModule);