[PATCH] D53403: [llvm-objdump] Fix --file-headers (-f) option
Petar Jovanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 19 15:18:58 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344818: [llvm-objdump] Fix --file-headers (-f) option (authored by petarj, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D53403?vs=170171&id=170263#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53403
Files:
llvm/trunk/test/tools/llvm-objdump/file-headers-coff.test
llvm/trunk/test/tools/llvm-objdump/file-headers-elf.test
llvm/trunk/test/tools/llvm-objdump/file-headers-pe.test
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
@@ -2220,8 +2220,11 @@
Expected<uint64_t> StartAddrOrErr = o->getStartAddress();
if (!StartAddrOrErr)
report_error(o->getFileName(), StartAddrOrErr.takeError());
+
+ StringRef Fmt = o->getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64;
+ uint64_t Address = StartAddrOrErr.get();
outs() << "start address: "
- << format("0x%0*x", o->getBytesInAddress(), StartAddrOrErr.get())
+ << "0x" << format(Fmt.data(), Address)
<< "\n";
}
Index: llvm/trunk/test/tools/llvm-objdump/file-headers-coff.test
===================================================================
--- llvm/trunk/test/tools/llvm-objdump/file-headers-coff.test
+++ llvm/trunk/test/tools/llvm-objdump/file-headers-coff.test
@@ -10,4 +10,4 @@
symbols:
# CHECK: architecture: i386
-# CHECK: start address: 0x0000
+# CHECK: start address: 0x00000000
Index: llvm/trunk/test/tools/llvm-objdump/file-headers-elf.test
===================================================================
--- llvm/trunk/test/tools/llvm-objdump/file-headers-elf.test
+++ llvm/trunk/test/tools/llvm-objdump/file-headers-elf.test
@@ -8,7 +8,7 @@
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
- Entry: 0x123456
+ Entry: 0x123456789abcde
# CHECK: architecture: x86_64
-# CHECK: start address: 0x00123456
+# CHECK: start address: 0x00123456789abcde
Index: llvm/trunk/test/tools/llvm-objdump/file-headers-pe.test
===================================================================
--- llvm/trunk/test/tools/llvm-objdump/file-headers-pe.test
+++ llvm/trunk/test/tools/llvm-objdump/file-headers-pe.test
@@ -7,7 +7,7 @@
Machine: IMAGE_FILE_MACHINE_I386
Characteristics: [ IMAGE_FILE_DEBUG_STRIPPED ]
OptionalHeader:
- AddressOfEntryPoint: 0x1234
+ AddressOfEntryPoint: 0x123456
# Unfortunately, all these flags are mandatory to set AddressOfEntryPoint.
# All the values are randomly picked. They can't interfere in what
# we are testing here.
@@ -30,4 +30,4 @@
symbols:
# CHECK: architecture: i386
-# CHECK: start address: 0x1234
+# CHECK: start address: 0x00123456
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53403.170263.patch
Type: text/x-patch
Size: 2352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181019/df878e3a/attachment.bin>
More information about the llvm-commits
mailing list