Reapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr.""

A latent bug in llvm-objdump used the wrong format specifier on 32-bit
targets, causing the test to fail. This fixes the issue.

llvm-svn: 267582
This commit is contained in:
Tim Northover 2016-04-26 18:29:16 +00:00
parent 4d0dcb9891
commit 4397837be2
3 changed files with 8 additions and 3 deletions

View 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.

View 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

View File

@ -343,7 +343,7 @@ static void PrintIndirectSymbolTable(MachOObjectFile *O, bool verbose,
if (cputype & MachO::CPU_ARCH_ABI64)
outs() << format("0x%016" PRIx64, addr + j * stride) << " ";
else
outs() << format("0x%08" PRIx32, addr + j * stride) << " ";
outs() << format("0x%08" PRIx32, (uint32_t)addr + j * stride) << " ";
MachO::dysymtab_command Dysymtab = O->getDysymtabLoadCommand();
uint32_t indirect_symbol = O->getIndirectSymbolTableEntry(Dysymtab, n + j);
if (indirect_symbol == MachO::INDIRECT_SYMBOL_LOCAL) {