--- /dev/null
+# RUN: llvm-objdump -m -d %p/Inputs/hello.obj.macho-x86_64 -no-show-raw-insn -print-imm-hex -no-leading-addr | FileCheck %s
+
+# CHECK: (__TEXT,__text) section
+# CHECK: _main:
+# CHECK: pushq %rbp
+# CHECK: movq %rsp, %rbp
+# CHECK: subq $0x20, %rsp
+# CHECK: leaq L_.str(%rip), %rax ## literal pool for: "Hello world\n"
+# CHECK: movl $_main, -0x4(%rbp)
+# CHECK: movl %edi, -0x8(%rbp)
+# CHECK: movq %rsi, -0x10(%rbp)
+# CHECK: movq %rdx, -0x18(%rbp)
+# CHECK: movq %rax, %rdi
+# CHECK: movb $0x0, %al
+# CHECK: callq _printf
+# CHECK: movl $_main, %ecx
+# CHECK: movl %eax, -0x1c(%rbp)
+# CHECK: movl %ecx, %eax
+# CHECK: addq $0x20, %rsp
+# CHECK: popq %rbp
+# CHECK: retq
+
+# CHECK-NOT: 0:
+# CHECK-NOT: 0000000000000000
static cl::opt<bool> FullLeadingAddr("full-leading-addr",
cl::desc("Print full leading address"));
+static cl::opt<bool> NoLeadingAddr("no-leading-addr",
+ cl::desc("Print no leading address"));
+
+
static cl::opt<bool>
PrintImmHex("print-imm-hex",
cl::desc("Use hex format for immediate values"));
outs() << "zerofill section and has no contents in the file\n";
break;
case MachO::S_CSTRING_LITERALS:
- DumpCstringSection(O, sect, sect_size, sect_addr, verbose);
+ DumpCstringSection(O, sect, sect_size, sect_addr, !NoLeadingAddr);
break;
case MachO::S_4BYTE_LITERALS:
- DumpLiteral4Section(O, sect, sect_size, sect_addr, verbose);
+ DumpLiteral4Section(O, sect, sect_size, sect_addr, !NoLeadingAddr);
break;
case MachO::S_8BYTE_LITERALS:
- DumpLiteral8Section(O, sect, sect_size, sect_addr, verbose);
+ DumpLiteral8Section(O, sect, sect_size, sect_addr, !NoLeadingAddr);
break;
case MachO::S_16BYTE_LITERALS:
- DumpLiteral16Section(O, sect, sect_size, sect_addr, verbose);
- break;
+ DumpLiteral16Section(O, sect, sect_size, sect_addr, !NoLeadingAddr);
+ break;
case MachO::S_LITERAL_POINTERS:
DumpLiteralPointerSection(O, Section, sect, sect_size, sect_addr,
- verbose);
+ !NoLeadingAddr);
break;
case MachO::S_MOD_INIT_FUNC_POINTERS:
case MachO::S_MOD_TERM_FUNC_POINTERS:
MCInst Inst;
uint64_t PC = SectAddress + Index;
- if (FullLeadingAddr) {
- if (MachOOF->is64Bit())
- outs() << format("%016" PRIx64, PC);
- else
- outs() << format("%08" PRIx64, PC);
- } else {
- outs() << format("%8" PRIx64 ":", PC);
+ if (!NoLeadingAddr) {
+ if (FullLeadingAddr) {
+ if (MachOOF->is64Bit())
+ outs() << format("%016" PRIx64, PC);
+ else
+ outs() << format("%08" PRIx64, PC);
+ } else {
+ outs() << format("%8" PRIx64 ":", PC);
+ }
}
if (!NoShowRawInsn)
outs() << "\t";
uint64_t PC = SectAddress + Index;
if (DisAsm->getInstruction(Inst, InstSize, Bytes.slice(Index), PC,
DebugOut, nulls())) {
- if (FullLeadingAddr) {
- if (MachOOF->is64Bit())
- outs() << format("%016" PRIx64, PC);
- else
- outs() << format("%08" PRIx64, PC);
- } else {
- outs() << format("%8" PRIx64 ":", PC);
+ if (!NoLeadingAddr) {
+ if (FullLeadingAddr) {
+ if (MachOOF->is64Bit())
+ outs() << format("%016" PRIx64, PC);
+ else
+ outs() << format("%08" PRIx64, PC);
+ } else {
+ outs() << format("%8" PRIx64 ":", PC);
+ }
}
if (!NoShowRawInsn) {
outs() << "\t";