diff --git a/test/tools/llvm-objdump/all-headers.test b/test/tools/llvm-objdump/all-headers.test index 6bb9a844f16..5cb78c7e3ec 100644 --- a/test/tools/llvm-objdump/all-headers.test +++ b/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 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 diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 088a120d31e..d26e49779a2 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -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;