[llvm] r185664 - Add support for archives with no symbol table or string table.

Rafael Espindola rafael.espindola at gmail.com
Thu Jul 4 12:40:23 PDT 2013


Author: rafael
Date: Thu Jul  4 14:40:23 2013
New Revision: 185664

URL: http://llvm.org/viewvc/llvm-project?rev=185664&view=rev
Log:
Add support for archives with no symbol table or string table.

Added:
    llvm/trunk/test/Object/Inputs/archive-test.a-gnu-minimal
Modified:
    llvm/trunk/lib/Object/Archive.cpp
    llvm/trunk/test/Object/nm-archive.test

Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=185664&r1=185663&r2=185664&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Thu Jul  4 14:40:23 2013
@@ -104,7 +104,7 @@ Archive::Archive(MemoryBuffer *source, e
   : Binary(Binary::ID_Archive, source) {
   // Check for sufficient magic.
   if (!source || source->getBufferSize()
-                 < (8 + sizeof(ArchiveMemberHeader) + 2) // Smallest archive.
+                 < (8 + sizeof(ArchiveMemberHeader)) // Smallest archive.
               || StringRef(source->getBufferStart(), 8) != Magic) {
     ec = object_error::invalid_file_type;
     return;

Added: llvm/trunk/test/Object/Inputs/archive-test.a-gnu-minimal
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/archive-test.a-gnu-minimal?rev=185664&view=auto
==============================================================================
--- llvm/trunk/test/Object/Inputs/archive-test.a-gnu-minimal (added)
+++ llvm/trunk/test/Object/Inputs/archive-test.a-gnu-minimal Thu Jul  4 14:40:23 2013
@@ -0,0 +1,2 @@
+!<arch>
+test/           1372964340  1000  1000  100664  0         `

Modified: llvm/trunk/test/Object/nm-archive.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/nm-archive.test?rev=185664&r1=185663&r2=185664&view=diff
==============================================================================
--- llvm/trunk/test/Object/nm-archive.test (original)
+++ llvm/trunk/test/Object/nm-archive.test Thu Jul  4 14:40:23 2013
@@ -9,6 +9,9 @@ RUN: llvm-nm %t2 | FileCheck %s -check-p
 Test we don't error with an archive with no symtab.
 RUN: llvm-nm %p/Inputs/archive-test.a-gnu-no-symtab
 
+Or in an archive with no symtab or string table.
+RUN: llvm-nm %p/Inputs/archive-test.a-gnu-minimal
+
 COFF: trivial-object-test.coff-i386:
 COFF-NEXT: 00000000 d .data
 COFF-NEXT: 00000000 t .text





More information about the llvm-commits mailing list