mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Add the option, -no-leading-addr llvm-objdump used with -macho and
-disassemble or -section to not print the leading addresses on each line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232547 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
RUN: llvm-objdump -m -section __TEXT,__cstring %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
|
RUN: llvm-objdump -m -section __TEXT,__cstring %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
|
||||||
|
RUN: llvm-objdump -m -section __TEXT,__cstring -no-leading-addr %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NO_ADDR
|
||||||
RUN: llvm-objdump -m -section __TEXT,__cstring -non-verbose %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NON_VERBOSE
|
RUN: llvm-objdump -m -section __TEXT,__cstring -non-verbose %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NON_VERBOSE
|
||||||
|
|
||||||
CHECK: Contents of (__TEXT,__cstring) section
|
CHECK: Contents of (__TEXT,__cstring) section
|
||||||
CHECK: 000000000000003b Hello world\n
|
CHECK: 000000000000003b Hello world\n
|
||||||
|
|
||||||
|
NO_ADDR: Contents of (__TEXT,__cstring) section
|
||||||
|
NO_ADDR: Hello world\n
|
||||||
|
NO_ADDR-NOT: 000000000000003b
|
||||||
|
|
||||||
NON_VERBOSE: Contents of (__TEXT,__cstring) section
|
NON_VERBOSE: Contents of (__TEXT,__cstring) section
|
||||||
NON_VERBOSE: 000000000000003b 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 00
|
NON_VERBOSE: 000000000000003b 48 65 6c 6c 6f 20 77 6f 72 6c 64 0a 00
|
||||||
|
24
test/tools/llvm-objdump/X86/macho-dis-no-leading-addr.test
Normal file
24
test/tools/llvm-objdump/X86/macho-dis-no-leading-addr.test
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# 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
|
@@ -63,6 +63,10 @@ static cl::opt<std::string> DSYMFile("dsym",
|
|||||||
static cl::opt<bool> FullLeadingAddr("full-leading-addr",
|
static cl::opt<bool> FullLeadingAddr("full-leading-addr",
|
||||||
cl::desc("Print full leading address"));
|
cl::desc("Print full leading address"));
|
||||||
|
|
||||||
|
static cl::opt<bool> NoLeadingAddr("no-leading-addr",
|
||||||
|
cl::desc("Print no leading address"));
|
||||||
|
|
||||||
|
|
||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
PrintImmHex("print-imm-hex",
|
PrintImmHex("print-imm-hex",
|
||||||
cl::desc("Use hex format for immediate values"));
|
cl::desc("Use hex format for immediate values"));
|
||||||
@@ -1072,20 +1076,20 @@ static void DumpSectionContents(StringRef Filename, MachOObjectFile *O,
|
|||||||
outs() << "zerofill section and has no contents in the file\n";
|
outs() << "zerofill section and has no contents in the file\n";
|
||||||
break;
|
break;
|
||||||
case MachO::S_CSTRING_LITERALS:
|
case MachO::S_CSTRING_LITERALS:
|
||||||
DumpCstringSection(O, sect, sect_size, sect_addr, verbose);
|
DumpCstringSection(O, sect, sect_size, sect_addr, !NoLeadingAddr);
|
||||||
break;
|
break;
|
||||||
case MachO::S_4BYTE_LITERALS:
|
case MachO::S_4BYTE_LITERALS:
|
||||||
DumpLiteral4Section(O, sect, sect_size, sect_addr, verbose);
|
DumpLiteral4Section(O, sect, sect_size, sect_addr, !NoLeadingAddr);
|
||||||
break;
|
break;
|
||||||
case MachO::S_8BYTE_LITERALS:
|
case MachO::S_8BYTE_LITERALS:
|
||||||
DumpLiteral8Section(O, sect, sect_size, sect_addr, verbose);
|
DumpLiteral8Section(O, sect, sect_size, sect_addr, !NoLeadingAddr);
|
||||||
break;
|
break;
|
||||||
case MachO::S_16BYTE_LITERALS:
|
case MachO::S_16BYTE_LITERALS:
|
||||||
DumpLiteral16Section(O, sect, sect_size, sect_addr, verbose);
|
DumpLiteral16Section(O, sect, sect_size, sect_addr, !NoLeadingAddr);
|
||||||
break;
|
break;
|
||||||
case MachO::S_LITERAL_POINTERS:
|
case MachO::S_LITERAL_POINTERS:
|
||||||
DumpLiteralPointerSection(O, Section, sect, sect_size, sect_addr,
|
DumpLiteralPointerSection(O, Section, sect, sect_size, sect_addr,
|
||||||
verbose);
|
!NoLeadingAddr);
|
||||||
break;
|
break;
|
||||||
case MachO::S_MOD_INIT_FUNC_POINTERS:
|
case MachO::S_MOD_INIT_FUNC_POINTERS:
|
||||||
case MachO::S_MOD_TERM_FUNC_POINTERS:
|
case MachO::S_MOD_TERM_FUNC_POINTERS:
|
||||||
@@ -3290,13 +3294,15 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
|||||||
MCInst Inst;
|
MCInst Inst;
|
||||||
|
|
||||||
uint64_t PC = SectAddress + Index;
|
uint64_t PC = SectAddress + Index;
|
||||||
if (FullLeadingAddr) {
|
if (!NoLeadingAddr) {
|
||||||
if (MachOOF->is64Bit())
|
if (FullLeadingAddr) {
|
||||||
outs() << format("%016" PRIx64, PC);
|
if (MachOOF->is64Bit())
|
||||||
else
|
outs() << format("%016" PRIx64, PC);
|
||||||
outs() << format("%08" PRIx64, PC);
|
else
|
||||||
} else {
|
outs() << format("%08" PRIx64, PC);
|
||||||
outs() << format("%8" PRIx64 ":", PC);
|
} else {
|
||||||
|
outs() << format("%8" PRIx64 ":", PC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!NoShowRawInsn)
|
if (!NoShowRawInsn)
|
||||||
outs() << "\t";
|
outs() << "\t";
|
||||||
@@ -3388,13 +3394,15 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
|||||||
uint64_t PC = SectAddress + Index;
|
uint64_t PC = SectAddress + Index;
|
||||||
if (DisAsm->getInstruction(Inst, InstSize, Bytes.slice(Index), PC,
|
if (DisAsm->getInstruction(Inst, InstSize, Bytes.slice(Index), PC,
|
||||||
DebugOut, nulls())) {
|
DebugOut, nulls())) {
|
||||||
if (FullLeadingAddr) {
|
if (!NoLeadingAddr) {
|
||||||
if (MachOOF->is64Bit())
|
if (FullLeadingAddr) {
|
||||||
outs() << format("%016" PRIx64, PC);
|
if (MachOOF->is64Bit())
|
||||||
else
|
outs() << format("%016" PRIx64, PC);
|
||||||
outs() << format("%08" PRIx64, PC);
|
else
|
||||||
} else {
|
outs() << format("%08" PRIx64, PC);
|
||||||
outs() << format("%8" PRIx64 ":", PC);
|
} else {
|
||||||
|
outs() << format("%8" PRIx64 ":", PC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!NoShowRawInsn) {
|
if (!NoShowRawInsn) {
|
||||||
outs() << "\t";
|
outs() << "\t";
|
||||||
|
Reference in New Issue
Block a user