[llvm] r242082 - Fix reading archive members with / in the name.
Rafael Espindola
rafael.espindola at gmail.com
Mon Jul 13 16:07:05 PDT 2015
Author: rafael
Date: Mon Jul 13 18:07:05 2015
New Revision: 242082
URL: http://llvm.org/viewvc/llvm-project?rev=242082&view=rev
Log:
Fix reading archive members with / in the name.
This is important for thin archives.
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=242082&r1=242081&r2=242082&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Archive.cpp (original)
+++ llvm/trunk/lib/Object/Archive.cpp Mon Jul 13 18:07:05 2015
@@ -162,10 +162,10 @@ ErrorOr<StringRef> Archive::Child::getNa
+ Parent->StringTable->getSize()))
return object_error::parse_failed;
- // GNU long file names end with a /.
+ // GNU long file names end with a "/\n".
if (Parent->kind() == K_GNU || Parent->kind() == K_MIPS64) {
- StringRef::size_type End = StringRef(addr).find('/');
- return StringRef(addr, End);
+ StringRef::size_type End = StringRef(addr).find('\n');
+ return StringRef(addr, End - 1);
}
return StringRef(addr);
} else if (name.startswith("#1/")) {
Modified: llvm/trunk/test/Object/archive-toc.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/archive-toc.test?rev=242082&r1=242081&r2=242082&view=diff
==============================================================================
--- llvm/trunk/test/Object/archive-toc.test (original)
+++ llvm/trunk/test/Object/archive-toc.test Mon Jul 13 18:07:05 2015
@@ -38,3 +38,9 @@ THIN-NEXT: rw-r--r-- 1000/1000 2280 20
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: {{.}}
+
+Test reading a thin archive with directory names.
+RUN: env TZ=GMT llvm-ar tv %p/Inputs/thin-path.a | FileCheck %s --check-prefix=THINPATH -strict-whitespace
+
+THINPATH: rw-r--r-- 0/0 1224 1970-01-01 00:00:00.000000000 test.o
+THINPATH-NEXT: rw-r--r-- 0/0 1224 1970-01-01 00:00:00.000000000 t/test2.o
More information about the llvm-commits
mailing list