summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2017-01-31 18:09:10 +0000
committerKevin Enderby <enderby@apple.com>2017-01-31 18:09:10 +0000
commit02d3a3785722e7cac6e8bf580ac2f7fc3cfdfc22 (patch)
tree0fe10171f78b90c0c334539c9ca59d07c39678c6 /llvm
parentaec4617dc8a8174c43dcf31c161a100f29b50d1e (diff)
downloadbcm5719-llvm-02d3a3785722e7cac6e8bf580ac2f7fc3cfdfc22.tar.gz
bcm5719-llvm-02d3a3785722e7cac6e8bf580ac2f7fc3cfdfc22.zip
Fix a bug in llvm-obdump(1) with the -macho flag disassembling an object
without symbols that makes calls through a symbol stub which were not correctly being annotated with “## symbol stub for: _foo”. Just adds the same parameters for getting the annotations from DisAsm->getInstruction() and passing them to IP->printInst() from the code above when boolean variable symbolTableWorked was true. rdar://29791952 llvm-svn: 293662
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/tools/llvm-objdump/X86/Inputs/stub-nosyms.macho-x86_64bin0 -> 528 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/X86/macho-stub-nosyms-disassembly.test3
-rw-r--r--llvm/tools/llvm-objdump/MachODump.cpp7
3 files changed, 8 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/Inputs/stub-nosyms.macho-x86_64 b/llvm/test/tools/llvm-objdump/X86/Inputs/stub-nosyms.macho-x86_64
new file mode 100644
index 00000000000..a7f122b5508
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/Inputs/stub-nosyms.macho-x86_64
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/X86/macho-stub-nosyms-disassembly.test b/llvm/test/tools/llvm-objdump/X86/macho-stub-nosyms-disassembly.test
new file mode 100644
index 00000000000..af66b0e7a63
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/macho-stub-nosyms-disassembly.test
@@ -0,0 +1,3 @@
+// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/stub-nosyms.macho-x86_64 | FileCheck %s
+
+CHECK: 0000000000000001 callq 0x7 ## symbol stub for: _foo
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 80cbe4bc657..b2e23f5032f 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -6798,8 +6798,10 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
MCInst Inst;
uint64_t PC = SectAddress + Index;
+ SmallVector<char, 64> AnnotationsBytes;
+ raw_svector_ostream Annotations(AnnotationsBytes);
if (DisAsm->getInstruction(Inst, InstSize, Bytes.slice(Index), PC,
- DebugOut, nulls())) {
+ DebugOut, Annotations)) {
if (!NoLeadingAddr) {
if (FullLeadingAddr) {
if (MachOOF->is64Bit())
@@ -6814,7 +6816,8 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
outs() << "\t";
dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs());
}
- IP->printInst(&Inst, outs(), "", *STI);
+ StringRef AnnotationsStr = Annotations.str();
+ IP->printInst(&Inst, outs(), AnnotationsStr, *STI);
outs() << "\n";
} else {
unsigned int Arch = MachOOF->getArch();
OpenPOWER on IntegriCloud