[Driver] Don't hardcode default linker on Linux

This is the C++ driver counterpart to a change that landed in the Swift
driver a while ago to use the clang-linker to determine what the default
linker is. This is to avoid hard-coding gold, which is deprecated and
not available on some newer Linux distributions. The challenge is that
these newer Linux distributions don't already have Swift so we have to
use the old C++ driver implementation.
This commit is contained in:
Evan Wilde
2025-04-02 16:32:44 -07:00
parent d15f6c7413
commit 500ddfeba4
3 changed files with 2 additions and 45 deletions

View File

@@ -1,4 +1,4 @@
// RUN: %swiftc_driver_plain -target aarch64-unknown-none-none -driver-print-jobs %s 2>&1 | %FileCheck %s
// CHECK: {{.*}}swift{{c|c-legacy-driver|-frontend}}{{(.exe)?"?}} -frontend -c
// CHECK: {{.*}}clang{{(.exe)?"?}} -fuse-ld=gold
// CHECK: {{.*}}clang{{(.exe)?"?}}

View File

@@ -344,7 +344,6 @@
// LINUX_DYNLIB-x86_64: clang{{(\.exe)?"? }}
// LINUX_DYNLIB-x86_64-DAG: -shared
// LINUX_DYNLIB-x86_64-DAG: -fuse-ld=gold
// LINUX_DYNLIB-x86_64-NOT: -pie
// LINUX_DYNLIB-x86_64-DAG: -Xlinker -rpath -Xlinker [[STDLIB_PATH:[^ ]+(/|\\\\)lib(/|\\\\)swift(/|\\\\)linux]]
// LINUX_DYNLIB-x86_64: [[STDLIB_PATH]]{{/|\\\\}}x86_64{{/|\\\\}}swiftrt.o