mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
Improve the handling of available_externally and llvm.global_ctors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132775 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9fe88973be
commit
d896d41851
@ -51,20 +51,32 @@ 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 {
|
||||
if (I->hasAvailableExternallyLinkage())
|
||||
continue;
|
||||
if (I->getName() == "llvm.global_ctors")
|
||||
continue;
|
||||
}
|
||||
|
||||
if (I->hasLocalLinkage())
|
||||
I->setVisibility(GlobalValue::HiddenVisibility);
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration())
|
||||
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 {
|
||||
if (I->hasAvailableExternallyLinkage())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (I->hasLocalLinkage())
|
||||
I->setVisibility(GlobalValue::HiddenVisibility);
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
if (deleteStuff == (bool)Named.count(I) && !I->isDeclaration())
|
||||
I->deleteBody();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user