If necessary for indirect encodings, emit stubs.

llvm-svn: 207730
This commit is contained in:
Joerg Sonnenberger 2014-05-01 00:25:15 +00:00
parent e1452c22e5
commit 0f90c95ccf
1 changed files with 22 additions and 0 deletions

View File

@ -545,6 +545,28 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
// generates code that does this, it is always safe to set.
OutStreamer.EmitAssemblerFlag(MCAF_SubsectionsViaSymbols);
}
// Emit a .data.rel section containing any stubs that were created.
if (Subtarget->isTargetELF()) {
const TargetLoweringObjectFileELF &TLOFELF =
static_cast<const TargetLoweringObjectFileELF &>(getObjFileLowering());
MachineModuleInfoELF &MMIELF = MMI->getObjFileInfo<MachineModuleInfoELF>();
// Output stubs for external and common global variables.
MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
if (!Stubs.empty()) {
OutStreamer.SwitchSection(TLOFELF.getDataRelSection());
const DataLayout *TD = TM.getDataLayout();
for (auto &stub: Stubs) {
OutStreamer.EmitLabel(stub.first);
OutStreamer.EmitSymbolValue(stub.second.getPointer(),
TD->getPointerSize(0));
}
Stubs.clear();
}
}
}
//===----------------------------------------------------------------------===//