mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
llvm-extract changes linkages so that functions on both sides of the
split module can see each other. If it is keeping a symbol that already has a non local linkage, it doesn't need to change it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166908 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -51,32 +51,44 @@ namespace {
|
||||
// Visit the GlobalVariables.
|
||||
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||
I != E; ++I) {
|
||||
if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration()) {
|
||||
I->setInitializer(0);
|
||||
} else {
|
||||
bool Delete =
|
||||
deleteStuff == (bool)Named.count(I) && !I->isDeclaration();
|
||||
if (!Delete) {
|
||||
if (I->hasAvailableExternallyLinkage())
|
||||
continue;
|
||||
if (I->getName() == "llvm.global_ctors")
|
||||
continue;
|
||||
}
|
||||
|
||||
if (I->hasLocalLinkage())
|
||||
bool Local = I->hasLocalLinkage();
|
||||
if (Local)
|
||||
I->setVisibility(GlobalValue::HiddenVisibility);
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
|
||||
if (Local || Delete)
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
|
||||
if (Delete)
|
||||
I->setInitializer(0);
|
||||
}
|
||||
|
||||
// Visit the Functions.
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
||||
if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration()) {
|
||||
I->deleteBody();
|
||||
} else {
|
||||
bool Delete =
|
||||
deleteStuff == (bool)Named.count(I) && !I->isDeclaration();
|
||||
if (!Delete) {
|
||||
if (I->hasAvailableExternallyLinkage())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (I->hasLocalLinkage())
|
||||
bool Local = I->hasLocalLinkage();
|
||||
if (Local)
|
||||
I->setVisibility(GlobalValue::HiddenVisibility);
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
|
||||
if (Local || Delete)
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
|
||||
if (Delete)
|
||||
I->deleteBody();
|
||||
}
|
||||
|
||||
// Visit the Aliases.
|
||||
@@ -85,9 +97,10 @@ namespace {
|
||||
Module::alias_iterator CurI = I;
|
||||
++I;
|
||||
|
||||
if (CurI->hasLocalLinkage())
|
||||
if (CurI->hasLocalLinkage()) {
|
||||
CurI->setVisibility(GlobalValue::HiddenVisibility);
|
||||
CurI->setLinkage(GlobalValue::ExternalLinkage);
|
||||
CurI->setLinkage(GlobalValue::ExternalLinkage);
|
||||
}
|
||||
|
||||
if (deleteStuff == (bool)Named.count(CurI)) {
|
||||
Type *Ty = CurI->getType()->getElementType();
|
||||
|
||||
Reference in New Issue
Block a user