summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2016-04-25 21:12:04 +0000
committerTim Northover <tnorthover@apple.com>2016-04-25 21:12:04 +0000
commit5c3140f7458a980af71d9fcea30ee688c7df2831 (patch)
tree3f427246ec2bbc470e28c7be8a54f9f9b50cd812 /llvm/lib/Target/ARM
parent8407f5b3bdc129a795df6b58a03e917a69eb4094 (diff)
downloadbcm5719-llvm-5c3140f7458a980af71d9fcea30ee688c7df2831.tar.gz
bcm5719-llvm-5c3140f7458a980af71d9fcea30ee688c7df2831.zip
ARM: put extern __thread stubs in a special section.
The linker needs to know that the symbols are thread-local to do its job properly. llvm-svn: 267473
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index 20c97e9835c..6d0608f9baa 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -527,6 +527,19 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
OutStreamer->AddBlankLine();
}
+ Stubs = MMIMacho.GetThreadLocalGVStubList();
+ if (!Stubs.empty()) {
+ // Switch with ".non_lazy_symbol_pointer" directive.
+ OutStreamer->SwitchSection(TLOFMacho.getThreadLocalPointerSection());
+ EmitAlignment(2);
+
+ for (auto &Stub : Stubs)
+ emitNonLazySymbolPointer(*OutStreamer, Stub.first, Stub.second);
+
+ Stubs.clear();
+ OutStreamer->AddBlankLine();
+ }
+
// Funny Darwin hack: This flag tells the linker that no global symbols
// contain code that falls through to other global symbols (e.g. the obvious
// implementation of multiple entry points). If this doesn't occur, the
@@ -891,8 +904,11 @@ MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV,
MachineModuleInfoMachO &MMIMachO =
MMI->getObjFileInfo<MachineModuleInfoMachO>();
MachineModuleInfoImpl::StubValueTy &StubSym =
- GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(MCSym)
- : MMIMachO.getGVStubEntry(MCSym);
+ GV->isThreadLocal()
+ ? MMIMachO.getThreadLocalGVStubEntry(MCSym)
+ : (GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(MCSym)
+ : MMIMachO.getGVStubEntry(MCSym));
+
if (!StubSym.getPointer())
StubSym = MachineModuleInfoImpl::StubValueTy(getSymbol(GV),
!GV->hasInternalLinkage());
OpenPOWER on IntegriCloud