# section afterwards. We had negative label difference assertions when .cv_loc
# bound tightly to the next instruction.
-# ASM: 0000000000000000 _callit:
+# ASM: 00000000 _callit:
# begin inline {
# ASM-NEXT: 0: e8 00 00 00 00 calll 0 <_callit+0x5>
# ASM-NEXT: 5: 85 c0 testl %eax, %eax
# }
-# ASM: 0000000000000000 _callit:
+# ASM: 00000000 _callit:
# begin inline {
# ASM-NEXT: 0: e8 00 00 00 00 calll 0 <_callit+0x5>
# ASM-NEXT: 5: 85 c0 testl %eax, %eax
# RUN: llvm-mc -triple=powerpc-unknown-linux -filetype=obj %s -o %t.o
# RUN: llvm-objdump -d %t.o | FileCheck %s
-# CHECK: 0000000000000000 callee_back:
+# CHECK: {{0*}}00000000 callee_back:
# CHECK: 18: {{.*}} bl .-24
# CHECK: 20: {{.*}} bl .+16
-# CHECK: 0000000000000030 callee_forward:
+# CHECK: {{0*}}00000030 callee_forward:
.text
.global caller
-// RUN: llvm-mc %s -filetype=obj -triple=x86_64-pc-linux -o %t.o
+# RUN: llvm-mc %s -filetype=obj -triple=i386 -o %t.32.o
+# RUN: llvm-mc %s -filetype=obj -triple=x86_64 -o %t.64.o
-// Check we print the address of `foo` and `bar`.
-// RUN: llvm-objdump -d %t.o | FileCheck %s
-// CHECK: 0000000000000000 foo:
-// CHECK-NEXT: 0: {{.*}} nop
-// CHECK-NEXT: 1: {{.*}} nop
-// CHECK: 0000000000000002 bar:
-// CHECK-NEXT: 2: {{.*}} nop
+## Check we print the address of `foo` and `bar`.
+# RUN: llvm-objdump -d %t.32.o | FileCheck --check-prefixes=ADDR32,ADDR %s
+# RUN: llvm-objdump -d %t.64.o | FileCheck --check-prefixes=ADDR64,ADDR %s
+# ADDR32: 00000000 foo:
+# ADDR64: 0000000000000000 foo:
+# ADDR-NEXT: 0: {{.*}} nop
+# ADDR-NEXT: 1: {{.*}} nop
+# ADDR32: 00000002 bar:
+# ADDR64: 0000000000000002 bar:
+# ADDR-NEXT: 2: {{.*}} nop
-// Check we do not print the addresses with -no-leading-addr.
-// RUN: llvm-objdump -d --no-leading-addr %t.o | FileCheck %s --check-prefix=NOADDR
-// NOADDR: {{^}}foo:
-// NOADDR-NEXT: {{.*}} nop
-// NOADDR-NEXT: {{.*}} nop
-// NOADDR: {{^}}bar:
-// NOADDR-NEXT: {{.*}} nop
+## Check we do not print the addresses with --no-leading-addr.
+# RUN: llvm-objdump -d --no-leading-addr %t.32.o | FileCheck %s --check-prefix=NOADDR
+# RUN: llvm-objdump -d --no-leading-addr %t.64.o | FileCheck %s --check-prefix=NOADDR
+# NOADDR: {{^}}foo:
+# NOADDR-NEXT: {{.*}} nop
+# NOADDR-NEXT: {{.*}} nop
+# NOADDR: {{^}}bar:
+# NOADDR-NEXT: {{.*}} nop
.text
.globl foo
}
static void printRelocation(const RelocationRef &Rel, uint64_t Address,
- uint8_t AddrSize) {
- StringRef Fmt =
- AddrSize > 4 ? "\t\t%016" PRIx64 ": " : "\t\t\t%08" PRIx64 ": ";
+ bool Is64Bits) {
+ StringRef Fmt = Is64Bits ? "\t\t%016" PRIx64 ": " : "\t\t\t%08" PRIx64 ": ";
SmallString<16> Name;
SmallString<32> Val;
Rel.getTypeName(Name);
auto PrintReloc = [&]() -> void {
while ((RelCur != RelEnd) && (RelCur->getOffset() <= Address.Address)) {
if (RelCur->getOffset() == Address.Address) {
- printRelocation(*RelCur, Address.Address, 4);
+ printRelocation(*RelCur, Address.Address, false);
return;
}
++RelCur;
std::map<SectionRef, std::vector<RelocationRef>> RelocMap;
if (InlineRelocs)
RelocMap = getRelocsMap(*Obj);
+ bool Is64Bits = Obj->getBytesInAddress() > 4;
// Create a mapping from virtual address to symbol name. This is used to
// pretty print the symbols while disassembling.
outs() << '\n';
if (!NoLeadingAddr)
- outs() << format("%016" PRIx64 " ",
+ outs() << format(Is64Bits ? "%016" PRIx64 " " : "%08" PRIx64 " ",
SectionAddr + Start + VMAAdjustment);
StringRef SymbolName = std::get<1>(Symbols[SI]);
Offset += AdjustVMA;
}
- printRelocation(*RelCur, SectionAddr + Offset,
- Obj->getBytesInAddress());
+ printRelocation(*RelCur, SectionAddr + Offset, Is64Bits);
++RelCur;
}
}