forked from OSchip/llvm-project
Prime text sections to improve branch locality in large object files.
llvm-svn: 31969
This commit is contained in:
parent
f4e2e009d9
commit
ec05b046c7
|
@ -543,6 +543,19 @@ bool DarwinAsmPrinter::doInitialization(Module &M) {
|
||||||
// Darwin wants symbols to be quoted if they have complex names.
|
// Darwin wants symbols to be quoted if they have complex names.
|
||||||
Mang->setUseQuotes(true);
|
Mang->setUseQuotes(true);
|
||||||
|
|
||||||
|
// Prime text sections so they are adjacent. This reduces the likelihood a
|
||||||
|
// large data or debug section causes a branch to exceed 16M limit.
|
||||||
|
SwitchToTextSection(".section __TEXT,__textcoal_nt,coalesced,"
|
||||||
|
"pure_instructions");
|
||||||
|
if (TM.getRelocationModel() == Reloc::PIC_) {
|
||||||
|
SwitchToTextSection(".section __TEXT,__picsymbolstub1,symbol_stubs,"
|
||||||
|
"pure_instructions,32");
|
||||||
|
} else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) {
|
||||||
|
SwitchToTextSection(".section __TEXT,__symbol_stub1,symbol_stubs,"
|
||||||
|
"pure_instructions,16");
|
||||||
|
}
|
||||||
|
SwitchToTextSection(TAI->getTextSection());
|
||||||
|
|
||||||
// Emit initial debug information.
|
// Emit initial debug information.
|
||||||
DW.BeginModule(&M);
|
DW.BeginModule(&M);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue