forked from OSchip/llvm-project
minor cleanups: only switch sections once before all function stubs, instead of
before each one. llvm-svn: 75718
This commit is contained in:
parent
00d4fb45e5
commit
0b1ca0a303
|
@ -366,7 +366,8 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
// Computing the address of an external symbol, not calling it.
|
// Computing the address of an external symbol, not calling it.
|
||||||
if (TM.getRelocationModel() != Reloc::Static) {
|
if (TM.getRelocationModel() != Reloc::Static) {
|
||||||
std::string Name(TAI->getGlobalPrefix()); Name += MO.getSymbolName();
|
std::string Name(TAI->getGlobalPrefix());
|
||||||
|
Name += MO.getSymbolName();
|
||||||
GVStubs.insert(Name);
|
GVStubs.insert(Name);
|
||||||
printSuffixedName(Name, "$non_lazy_ptr");
|
printSuffixedName(Name, "$non_lazy_ptr");
|
||||||
return;
|
return;
|
||||||
|
@ -381,17 +382,15 @@ void PPCAsmPrinter::printOp(const MachineOperand &MO) {
|
||||||
// External or weakly linked global variables need non-lazily-resolved stubs
|
// External or weakly linked global variables need non-lazily-resolved stubs
|
||||||
if (TM.getRelocationModel() != Reloc::Static) {
|
if (TM.getRelocationModel() != Reloc::Static) {
|
||||||
if (GV->isDeclaration() || GV->isWeakForLinker()) {
|
if (GV->isDeclaration() || GV->isWeakForLinker()) {
|
||||||
if (GV->hasHiddenVisibility()) {
|
if (!GV->hasHiddenVisibility()) {
|
||||||
if (GV->isDeclaration() || GV->hasCommonLinkage() ||
|
|
||||||
GV->hasAvailableExternallyLinkage()) {
|
|
||||||
HiddenGVStubs.insert(Name);
|
|
||||||
printSuffixedName(Name, "$non_lazy_ptr");
|
|
||||||
} else {
|
|
||||||
O << Name;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
GVStubs.insert(Name);
|
GVStubs.insert(Name);
|
||||||
printSuffixedName(Name, "$non_lazy_ptr");
|
printSuffixedName(Name, "$non_lazy_ptr");
|
||||||
|
} else if (GV->isDeclaration() || GV->hasCommonLinkage() ||
|
||||||
|
GV->hasAvailableExternallyLinkage()) {
|
||||||
|
HiddenGVStubs.insert(Name);
|
||||||
|
printSuffixedName(Name, "$non_lazy_ptr");
|
||||||
|
} else {
|
||||||
|
O << Name;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -962,11 +961,11 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
||||||
bool isPPC64 = TD->getPointerSizeInBits() == 64;
|
bool isPPC64 = TD->getPointerSizeInBits() == 64;
|
||||||
|
|
||||||
// Output stubs for dynamically-linked functions
|
// Output stubs for dynamically-linked functions
|
||||||
if (TM.getRelocationModel() == Reloc::PIC_) {
|
if (TM.getRelocationModel() == Reloc::PIC_ && !FnStubs.empty()) {
|
||||||
|
SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs,"
|
||||||
|
"pure_instructions,32");
|
||||||
for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
|
for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
|
||||||
i != e; ++i) {
|
i != e; ++i) {
|
||||||
SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs,"
|
|
||||||
"pure_instructions,32");
|
|
||||||
EmitAlignment(4);
|
EmitAlignment(4);
|
||||||
const char *p = i->getKeyData();
|
const char *p = i->getKeyData();
|
||||||
bool hasQuote = p[0]=='\"';
|
bool hasQuote = p[0]=='\"';
|
||||||
|
@ -1017,11 +1016,11 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
||||||
else
|
else
|
||||||
O << "\t.long dyld_stub_binding_helper\n";
|
O << "\t.long dyld_stub_binding_helper\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!FnStubs.empty()) {
|
||||||
|
SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
|
||||||
|
"pure_instructions,16");
|
||||||
for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
|
for (StringSet<>::iterator i = FnStubs.begin(), e = FnStubs.end();
|
||||||
i != e; ++i) {
|
i != e; ++i) {
|
||||||
SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
|
|
||||||
"pure_instructions,16");
|
|
||||||
EmitAlignment(4);
|
EmitAlignment(4);
|
||||||
const char *p = i->getKeyData();
|
const char *p = i->getKeyData();
|
||||||
printSuffixedName(p, "$stub");
|
printSuffixedName(p, "$stub");
|
||||||
|
|
Loading…
Reference in New Issue