[llvm] r241750 - Don't reject an archive with just a symbol table.

Rafael Espindola rafael.espindola at gmail.com
Wed Jul 8 15:27:54 PDT 2015


Author: rafael
Date: Wed Jul  8 17:27:54 2015
New Revision: 241750

URL: http://llvm.org/viewvc/llvm-project?rev=241750&view=rev
Log:
Don't reject an archive with just a symbol table.

It is pretty unambiguous how to interpret it and gnu ar accepts it too.

Added:
    llvm/trunk/test/Object/Inputs/symtab-only.a
Modified:
    llvm/trunk/lib/Object/Archive.cpp
    llvm/trunk/test/Object/archive-toc.test

Modified: llvm/trunk/lib/Object/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=241750&r1=241749&r2=241750&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Wed Jul  8 17:27:54 2015
@@ -288,7 +288,7 @@ Archive::Archive(MemoryBufferRef Source,
 
     ++i;
     if (i == e) {
-      ec = object_error::parse_failed;
+      ec = std::error_code();
       return;
     }
     Name = i->getRawName();

Added: llvm/trunk/test/Object/Inputs/symtab-only.a
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Inputs/symtab-only.a?rev=241750&view=auto
==============================================================================
Binary files llvm/trunk/test/Object/Inputs/symtab-only.a (added) and llvm/trunk/test/Object/Inputs/symtab-only.a Wed Jul  8 17:27:54 2015 differ

Modified: llvm/trunk/test/Object/archive-toc.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/archive-toc.test?rev=241750&r1=241749&r2=241750&view=diff
==============================================================================
--- llvm/trunk/test/Object/archive-toc.test (original)
+++ llvm/trunk/test/Object/archive-toc.test Wed Jul  8 17:27:54 2015
@@ -34,3 +34,7 @@ THIN:      rw-r--r-- 1000/1000      8 20
 THIN-NEXT: rw-r--r-- 1000/1000      7 2014-12-16 00:56:27.000000000 oddlen
 THIN-NEXT: rwxr-xr-x 1000/1000   1465 2014-12-16 00:56:27.000000000 very_long_bytecode_file_name.bc
 THIN-NEXT: rw-r--r-- 1000/1000   2280 2014-12-16 00:56:27.000000000 IsNAN.o
+
+Test reading an archive with just a symbol table. We use to reject them.
+RUN: llvm-ar tv %p/Inputs/symtab-only.a | FileCheck --allow-empty --check-prefix=EMPTY %s
+EMPTY-NOT: {{.}}





More information about the llvm-commits mailing list