]> granicus.if.org Git - llvm/commitdiff
[llvm-objdump] - Dump the archive headers when -all-headers is specified.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 18 Jan 2019 12:01:59 +0000 (12:01 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 18 Jan 2019 12:01:59 +0000 (12:01 +0000)
When -all-headers is given it is supposed to dump all headers,
but now it skips the archive headers for no reason.

The patch fixes that.

Differential revision: https://reviews.llvm.org/D56780

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351547 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-objdump/all-headers.test
tools/llvm-objdump/llvm-objdump.cpp

index 6bb9a844f16108e2ac8659a7f4dd5ba1332013c7..5cb78c7e3ecc7cf4c64e1391c2cf65522a4cfe7d 100644 (file)
 # CHECK-EMPTY:
 # CHECK-NEXT:  Sections:
 
+## Check how we dump the archives.
+## Check we dump the appropriate headers for each file in the archive.
+
+# RUN: cp %t %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
index 088a120d31e34e1bb976f1007f5de6adb4e9ca75..d26e49779a231bc3d51379cfad58a5728c3a033c 100644 (file)
@@ -2036,8 +2036,8 @@ int main(int argc, char **argv) {
     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;