[PATCH] D56780: [llvm-objdump] - Dump the archive headers when -all-headers is specified
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 17 05:48:31 PST 2019
grimar updated this revision to Diff 182258.
grimar added a comment.
I added a requested test showing how -all-headers now dumps the archive headers.
(and removed the old test since the new one covers the added functionality).
There is a little difference in the order between llvm-objump and GNU objdump.
The latter prints them before the `architecture:`
> In archive all-headers.test.tmp.a:
>
> all-headers.test.tmp: file format elf64-x86-64
> rw-r--r-- 0/0 372 Jan 1 03:00 1970 all-headers.test.tmp
> architecture: i386:x86-64, flags 0x00000012:
> EXEC_P, HAS_SYMS
> start address 0x0000000000000000
I am not sure how much it is important to change
(given that we are not 1:1 equal in output),
but it is not what this patch tries to fix anyways and we can do that separately.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56780/new/
https://reviews.llvm.org/D56780
Files:
test/tools/llvm-objdump/all-headers.test
tools/llvm-objdump/llvm-objdump.cpp
Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -2465,8 +2465,8 @@
InputFilenames.push_back("a.out");
if (AllHeaders)
- FileHeaders = PrivateHeaders = Relocations = SectionHeaders = SymbolTable =
- true;
+ ArchiveHeaders = FileHeaders = PrivateHeaders = Relocations =
+ SectionHeaders = SymbolTable = true;
if (DisassembleAll || PrintSource || PrintLines)
Disassemble = true;
Index: test/tools/llvm-objdump/all-headers.test
===================================================================
--- test/tools/llvm-objdump/all-headers.test
+++ test/tools/llvm-objdump/all-headers.test
@@ -11,6 +11,31 @@
# CHECK-EMPTY:
# CHECK-NEXT: Sections:
+## Check how we dump the archives.
+## Check we dump the appropriate headers for each file in archive.
+
+# RUN: yaml2obj %s > %t2
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcs %t.a %t %t2
+# RUN: llvm-objdump --all-headers %t.a | FileCheck %s --check-prefix=ARCHIVE
+
+# ARCHIVE: {{.*}}.a({{.*}}): file format ELF64-x86-64
+# ARCHIVE: architecture: x86_64
+# ARCHIVE: start address: 0x0000000000000000
+# ARCHIVE: rw-r--r--
+# ARCHIVE: Sections:
+# ARCHIVE: SYMBOL TABLE:
+# ARCHIVE: Program Header:
+# ARCHIVE: Dynamic Section:
+# ARCHIVE: {{.*}}.a({{.*}}2): file format ELF64-x86-64
+# ARCHIVE: architecture: x86_64
+# ARCHIVE: start address: 0x0000000000000000
+# ARCHIVE: rw-r--r--
+# ARCHIVE: Sections:
+# ARCHIVE: SYMBOL TABLE:
+# ARCHIVE: Program Header:
+# ARCHIVE: Dynamic Section:
+
!ELF
FileHeader:
Class: ELFCLASS64
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56780.182258.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190117/3a1c6c98/attachment.bin>
More information about the llvm-commits
mailing list