Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1209,7 +1209,10 @@ break; } case ToolChain::UNW_CompilerRT: - CmdArgs.push_back("-lunwind"); + if (LGT == LibGccType::StaticLibGcc) + CmdArgs.push_back("-l:libunwind.a"); + else + CmdArgs.push_back("-l:libunwind.so"); break; } Index: clang/test/Driver/compiler-rt-unwind.c =================================================================== --- clang/test/Driver/compiler-rt-unwind.c +++ clang/test/Driver/compiler-rt-unwind.c @@ -13,7 +13,15 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s // RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc" -// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lunwind" +// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}l:libunwind.so" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \ +// RUN: -static-libgcc \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=RTLIB-GCC-STATIC-UNWINDLIB-COMPILER-RT %s +// RTLIB-GCC-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc" +// RTLIB-GCC-STATIC-UNWINDLIB-COMPILER-RT: "{{.*}}l:libunwind.a" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \