[llvm] r242354 - llvm-ar: Don't write the directory in the string table.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jul 15 16:15:33 PDT 2015
Author: rafael
Date: Wed Jul 15 18:15:33 2015
New Revision: 242354
URL: http://llvm.org/viewvc/llvm-project?rev=242354&view=rev
Log:
llvm-ar: Don't write the directory in the string table.
We were already doing the right thing for short file names, but not long
ones.
Modified:
llvm/trunk/lib/Object/ArchiveWriter.cpp
llvm/trunk/test/Object/archive-format.test
Modified: llvm/trunk/lib/Object/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ArchiveWriter.cpp?rev=242354&r1=242353&r2=242354&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Object/ArchiveWriter.cpp Wed Jul 15 18:15:33 2015
@@ -160,7 +160,7 @@ static void writeStringTable(raw_fd_ostr
bool Thin) {
unsigned StartOffset = 0;
for (const NewArchiveIterator &I : Members) {
- StringRef Name = I.getName();
+ StringRef Name = sys::path::filename(I.getName());
if (!useStringTable(Thin, Name))
continue;
if (StartOffset == 0) {
Modified: llvm/trunk/test/Object/archive-format.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/archive-format.test?rev=242354&r1=242353&r2=242354&view=diff
==============================================================================
--- llvm/trunk/test/Object/archive-format.test (original)
+++ llvm/trunk/test/Object/archive-format.test Wed Jul 15 18:15:33 2015
@@ -6,17 +6,26 @@ RUN: cd %t
RUN: echo -n bar. > 0123456789abcde
RUN: echo -n zed. > 0123456789abcdef
+RUN: mkdir -p foo
+RUN: echo -n bar2 > foo/0123456789abcde
+RUN: echo -n zed2 > foo/0123456789abcdef
RUN: rm -f %t.a
-RUN: llvm-ar --format=gnu rc %t.a 0123456789abcde 0123456789abcdef
+RUN: llvm-ar --format=gnu rc %t.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef
RUN: cat %t.a | FileCheck -strict-whitespace %s
CHECK: !<arch>
-CHECK-NEXT: // 18 `
+CHECK-NEXT: // 36 `
+CHECK-NEXT: 0123456789abcdef/
CHECK-NEXT: 0123456789abcdef/
CHECK-NEXT: 0123456789abcde/0 0 0 644 4 `
-CHECK-NEXT: bar./0 0 0 0 644 4 `
+CHECK-NEXT: bar.
+CHECK-SAME: /0 0 0 0 644 4 `
CHECK-NEXT: zed.
+CHECK-SAME: 0123456789abcde/0 0 0 644 4 `
+CHECK-NEXT: bar2
+CHECK-SAME: /18 0 0 0 644 4 `
+CHECK-NEXT: zed2
RUN: rm -f %t.a
RUN: llvm-ar --format=bsd rc %t.a 0123456789abcde 0123456789abcdef
More information about the llvm-commits
mailing list