OSDN Git Service

ARM: put correct symbol index on indirect pointers in __thread_ptr.
authorTim Northover <tnorthover@apple.com>
Mon, 25 Apr 2016 22:36:07 +0000 (22:36 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 25 Apr 2016 22:36:07 +0000 (22:36 +0000)
Otherwise the linker has no idea what should be resolved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267488 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MachObjectWriter.cpp
test/MC/ARM/tls-directives.s

index f33b866..e392719 100644 (file)
@@ -471,7 +471,8 @@ void MachObjectWriter::bindIndirectSymbols(MCAssembler &Asm) {
          ie = Asm.indirect_symbol_end(); it != ie; ++it, ++IndirectIndex) {
     const MCSectionMachO &Section = cast<MCSectionMachO>(*it->Section);
 
-    if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS)
+    if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
+        Section.getType() !=  MachO::S_THREAD_LOCAL_VARIABLE_POINTERS)
       continue;
 
     // Initialize the section indirect symbol base, if necessary.
index c0e9f6c..69a0268 100644 (file)
@@ -1,5 +1,9 @@
 @ RUN: llvm-mc -triple thumbv7-apple-ios -filetype=obj -o %t %s
-@ RUN: llvm-objdump -p %t | FileCheck %s
+@ RUN: llvm-objdump -macho -p -indirect-symbols %t | FileCheck %s
+
+@ CHECK: Indirect symbols for (__DATA,__thread_ptr)
+@ CHECK: 0x0000001c     5 _a
+
 
 @ CHECK: sectname __thread_data
 @ CHECK: segname __DATA