diff options
| author | Kuba Mracek <mracek@apple.com> | 2019-08-01 15:51:14 +0000 |
|---|---|---|
| committer | Kuba Mracek <mracek@apple.com> | 2019-08-01 15:51:14 +0000 |
| commit | a7c48b79a9d9c6eeab4985e0e8bd967ae9824999 (patch) | |
| tree | b9e892f817ba9a135827b694947040efaf711993 /llvm/test/tools | |
| parent | 350b389c90baa1ab9bfae21f0799bc8db8074b8d (diff) | |
| download | bcm5719-llvm-a7c48b79a9d9c6eeab4985e0e8bd967ae9824999.tar.gz bcm5719-llvm-a7c48b79a9d9c6eeab4985e0e8bd967ae9824999.zip | |
[llvm-objdump] Fix jumptable detection when disassembling Mach-O binaries
- Add LC_SEGMENT_64 handling in getSectionsAndSymbols to be able to find the base segment address from 64-bit Mach-O binaries.
- Add "data in code" detection into the !symbolTableWorked case, extract it into a separate function.
- Fix uninitialized variable usage on BaseSegmentAddress (initialize to 0).
- Add test.
Differential Revision: https://reviews.llvm.org/D65491
llvm-svn: 367578
Diffstat (limited to 'llvm/test/tools')
| -rw-r--r-- | llvm/test/tools/llvm-objdump/macho-data-in-code.ll | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/macho-data-in-code.ll b/llvm/test/tools/llvm-objdump/macho-data-in-code.ll new file mode 100644 index 00000000000..57877da09f3 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/macho-data-in-code.ll @@ -0,0 +1,45 @@ +; RUN: llc -mtriple x86_64-apple-darwin -filetype=obj -O0 %s -o %t.o +; RUN: llvm-objdump -macho -disassemble -no-show-raw-insn %t.o | FileCheck %s + +; CHECK: .long {{[0-9]+}} @ KIND_JUMP_TABLE32 +; CHECK: .long {{[0-9]+}} @ KIND_JUMP_TABLE32 +; CHECK: .long {{[0-9]+}} @ KIND_JUMP_TABLE32 +; CHECK: .long {{[0-9]+}} @ KIND_JUMP_TABLE32 +; CHECK-NOT: invalid instruction encoding +; CHECK-NOT: <unknown> + +; ModuleID = '-' +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.12.0" + +; Function Attrs: noinline nounwind optnone ssp uwtable +define void @switchfunc(i32 %i) { + switch i32 %i, label %out [ + i32 0, label %case1 + i32 1, label %case2 + i32 2, label %case3 + i32 3, label %case4 + ] + +case1: + call void @foo() + br label %out + +case2: + call void @bar() + br label %out + +case3: + call void @foo() + br label %out + +case4: + call void @bar() + br label %out + +out: + ret void +} + +declare void @foo() +declare void @bar() |

