Skip to content

Commit fa6c8fa

Browse files
committed
[Driver] Update to not do extension check for Linux archives
Also update tests slightly as an object was missing Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 94dd826 commit fa6c8fa

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6597,9 +6597,8 @@ bool clang::driver::isStaticArchiveFile(const StringRef &FileName) {
65976597
StringRef Ext(llvm::sys::path::extension(FileName).drop_front());
65986598
llvm::file_magic Magic;
65996599
llvm::identify_magic(FileName, Magic);
6600-
// Only .lib, .a and .lo files are to be considered.
6601-
return (Ext == "lib" ||
6602-
((Ext == "a" || Ext == "lo") && Magic == llvm::file_magic::archive));
6600+
// Only .lib and archive files are to be considered.
6601+
return (Ext == "lib" || Magic == llvm::file_magic::archive);
66036602
}
66046603

66056604
bool clang::driver::willEmitRemarks(const ArgList &Args) {

clang/test/Driver/sycl-offload-static-lib-2.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// RUN: llvm-ar cr %t_2.a %t1_bundle.o
1616
//
1717
// RUN: touch %t.a
18+
// RUN: touch %t.o
1819
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t.a -### %t.o 2>&1 \
1920
// RUN: | FileCheck %s -check-prefix=STATIC_LIB -DINPUTA=%t.a -DINPUTO=%t.o
2021
// STATIC_LIB: ld{{(.exe)?}}" "-r" "-o" "[[INPUTLD:[^ ]+\.o]]" {{.*}} "-L/dummy/dir"{{.*}} "[[INPUTO]]" "[[INPUTA]]"
@@ -23,6 +24,7 @@
2324
// STATIC_LIB: ld{{.*}} "[[INPUTA]]" "[[INPUTO]]"
2425

2526
// RUN: touch %t.lo
27+
// RUN: touch %t.o
2628
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -L/dummy/dir %t.lo -### %t.o 2>&1 \
2729
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_LO -DINPUTLO=%t.lo -DINPUTO=%t.o
2830
// STATIC_LIB_LO: ld{{(.exe)?}}" "-r" "-o" "[[INPUTLD:[^ ]+\.o]]" {{.*}} "-L/dummy/dir"{{.*}} "[[INPUTO]]" "[[INPUTLO]]"

clang/test/Driver/sycl-offload-static-lib.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// RUN: echo "void foo(void) {}" > %t1.cpp
1010
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl %t1.cpp -c -o %t1_bundle.o
1111
// RUN: llvm-ar cr %t.a %t1_bundle.o
12-
// RUN: llvm-ar cr %t.lo %t1_bundle.o
1312
// RUN: llvm-ar cr %t_2.a %t1_bundle.o
1413

1514
/// ###########################################################################

0 commit comments

Comments
 (0)