Skip to content

Commit 5e36433

Browse files
author
George Rimar
committed
[llvm-objdump] - Dump the archive headers when -all-headers is specified.
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 llvm-svn: 351547
1 parent ef19af1 commit 5e36433

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,31 @@
1111
# CHECK-EMPTY:
1212
# CHECK-NEXT: Sections:
1313

14+
## Check how we dump the archives.
15+
## Check we dump the appropriate headers for each file in the archive.
16+
17+
# RUN: cp %t %t2
18+
# RUN: rm -f %t.a
19+
# RUN: llvm-ar rcs %t.a %t %t2
20+
# RUN: llvm-objdump --all-headers %t.a | FileCheck %s --check-prefix=ARCHIVE
21+
22+
# ARCHIVE: {{.*}}.a({{.*}}): file format ELF64-x86-64
23+
# ARCHIVE: architecture: x86_64
24+
# ARCHIVE: start address: 0x0000000000000000
25+
# ARCHIVE: rw-r--r--
26+
# ARCHIVE: Sections:
27+
# ARCHIVE: SYMBOL TABLE:
28+
# ARCHIVE: Program Header:
29+
# ARCHIVE: Dynamic Section:
30+
# ARCHIVE: {{.*}}.a({{.*}}2): file format ELF64-x86-64
31+
# ARCHIVE: architecture: x86_64
32+
# ARCHIVE: start address: 0x0000000000000000
33+
# ARCHIVE: rw-r--r--
34+
# ARCHIVE: Sections:
35+
# ARCHIVE: SYMBOL TABLE:
36+
# ARCHIVE: Program Header:
37+
# ARCHIVE: Dynamic Section:
38+
1439
!ELF
1540
FileHeader:
1641
Class: ELFCLASS64

llvm/tools/llvm-objdump/llvm-objdump.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,8 +2036,8 @@ int main(int argc, char **argv) {
20362036
InputFilenames.push_back("a.out");
20372037

20382038
if (AllHeaders)
2039-
FileHeaders = PrivateHeaders = Relocations = SectionHeaders = SymbolTable =
2040-
true;
2039+
ArchiveHeaders = FileHeaders = PrivateHeaders = Relocations =
2040+
SectionHeaders = SymbolTable = true;
20412041

20422042
if (DisassembleAll || PrintSource || PrintLines)
20432043
Disassemble = true;

0 commit comments

Comments
 (0)