[PATCH] D53690: [llvm-objdump] Don't Crash When Using `-a` on Non-Archives (PR39402)
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 29 07:19:29 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345503: [llvm-objdump] Don't crash when using `-a` on non-archives (authored by jhenderson, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D53690?vs=171484&id=171497#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53690
Files:
llvm/trunk/test/tools/llvm-objdump/non-archive-object.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
@@ -2309,8 +2309,8 @@
outs() << ":\tfile format " << o->getFileFormatName() << "\n\n";
}
- if (ArchiveHeaders && !MachOOpt)
- printArchiveChild(a->getFileName(), *c);
+ if (ArchiveHeaders && !MachOOpt && c)
+ printArchiveChild(ArchiveName, *c);
if (Disassemble)
DisassembleObject(o, Relocations);
if (Relocations && !Disassemble)
@@ -2363,8 +2363,8 @@
<< ":\tfile format COFF-import-file"
<< "\n\n";
- if (ArchiveHeaders && !MachOOpt)
- printArchiveChild(A->getFileName(), *C);
+ if (ArchiveHeaders && !MachOOpt && C)
+ printArchiveChild(ArchiveName, *C);
if (SymbolTable)
printCOFFSymbolTable(I);
}
Index: llvm/trunk/test/tools/llvm-objdump/non-archive-object.test
===================================================================
--- llvm/trunk/test/tools/llvm-objdump/non-archive-object.test
+++ llvm/trunk/test/tools/llvm-objdump/non-archive-object.test
@@ -0,0 +1,25 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objdump -a %t | FileCheck %s
+
+# If this test has not crashed, then this test passed.
+# CHECK: file format ELF64-x86-64
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_X86_64
+Sections:
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_ALLOC ]
+ AddressAlign: 0x0000000000000010
+ Size: 64
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000010
+ Content: "01234567"
+ Size: 4
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53690.171497.patch
Type: text/x-patch
Size: 1862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181029/72170c9c/attachment.bin>
More information about the llvm-commits
mailing list