File tree Expand file tree Collapse file tree 6 files changed +23
-10
lines changed Expand file tree Collapse file tree 6 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -133,12 +133,14 @@ static void doList(opt::InputArgList& Args) {
133
133
object::Archive Archive (B.get ()->getMemBufferRef (), Err);
134
134
fatalOpenError (std::move (Err), B->getBufferIdentifier ());
135
135
136
+ std::vector<StringRef> Names;
136
137
for (auto &C : Archive.children (Err)) {
137
138
Expected<StringRef> NameOrErr = C.getName ();
138
139
fatalOpenError (NameOrErr.takeError (), B->getBufferIdentifier ());
139
- StringRef Name = NameOrErr.get ();
140
- llvm::outs () << Name << ' \n ' ;
140
+ Names.push_back (NameOrErr.get ());
141
141
}
142
+ for (auto Name : reverse (Names))
143
+ llvm::outs () << Name << ' \n ' ;
142
144
fatalOpenError (std::move (Err), B->getBufferIdentifier ());
143
145
}
144
146
@@ -392,6 +394,9 @@ int llvm::libDriverMain(ArrayRef<const char *> ArgsArr) {
392
394
}
393
395
}
394
396
397
+ // For compatibility with MSVC, reverse member vector after de-duplication.
398
+ std::reverse (Members.begin (), Members.end ());
399
+
395
400
if (Error E =
396
401
writeArchive (OutputPath, Members,
397
402
/* WriteSymtab=*/ true , object::Archive::K_GNU,
Original file line number Diff line number Diff line change
1
+ .globl c
2
+ c:
3
+ .globl a
4
+ a:
5
+ .globl b
6
+ b:
Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ RUN: mkdir -p %t
6
6
7
7
RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t/foo.o %S/Inputs/a.s
8
8
RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t/bar.o %S/Inputs/b.s
9
- RUN: llvm-lib -out:%t/foo.lib %t/foo.o %t/foo.o %t/bar.o
9
+ RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t/abc.o %S/Inputs/abc.s
10
+ RUN: llvm-lib -out:%t/foo.lib %t/foo.o %t/foo.o %t/abc.o %t/bar.o %t/foo.o %t/foo.o
10
11
11
12
RUN: llvm-ar t %t/foo.lib | FileCheck %s
12
- CHECK: foo.o
13
- CHECK-NOT: foo.o
14
13
CHECK: bar.o
14
+ CHECK-NEXT: abc.o
15
+ CHECK-NEXT: foo.o
16
+ CHECK-NOT: foo.o
Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ RUN: llvm-lib -out:%t/foo.lib %t/foo.o
10
10
RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t/bar.o %S/Inputs/b.s
11
11
RUN: llvm-lib -out:%t/bar.lib %t/foo.lib %t/bar.o
12
12
13
- RUN: llvm-ar t %t/bar.lib | FileCheck %s
13
+ RUN: llvm-lib -list %t/bar.lib | FileCheck %s
14
14
CHECK: foo.o
15
15
CHECK: bar.o
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ RUN: llvm-lib -out:foo.lib foo/a.obj foo/b.obj
13
13
RUN: llvm-ar t foo.lib | FileCheck %s
14
14
15
15
FIXME: We should probably use backslashes on Windows to better match MSVC tools.
16
- CHECK: foo/a.obj
17
16
CHECK: foo/b.obj
17
+ CHECK: foo/a.obj
18
18
19
19
Do it again with absolute paths and see that we get something.
20
20
RUN: llvm-lib -out:foo.lib %t/foo/a.obj %t/foo/b.obj
21
21
RUN: llvm-ar t foo.lib | FileCheck %s --check-prefix=ABS
22
22
23
- ABS: {{.*}}/foo/a.obj
24
23
ABS: {{.*}}/foo/b.obj
24
+ ABS: {{.*}}/foo/a.obj
Original file line number Diff line number Diff line change 1
1
# RUN: rm -rf %t && mkdir -p %t && cd %t
2
2
# RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o a.obj %S/Inputs/a.s
3
3
# RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o b.obj %S/Inputs/b.s
4
- # RUN: llvm-lib /out:xfghashmap.lib a .obj b .obj
4
+ # RUN: llvm-lib /out:xfghashmap.lib b .obj a .obj
5
5
6
6
## Replace a section in the library file with /<XFGHASHMAP>/ emulating
7
7
## a library from the Windows SDK for Windows 11.
10
10
## This should print the /<XFGHASHMAP>/ section as well as an .obj one.
11
11
# RUN: llvm-lib /list %t/xfghashmap.lib | FileCheck %s
12
12
13
- # CHECK: a.obj
14
13
# CHECK: /<XFGHASHMAP>/
15
14
# CHECK-NOT: b.obj
15
+ # CHECK: a.obj
16
16
17
17
import sys
18
18
You can’t perform that action at this time.
0 commit comments