You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update the logic to not use the running platform
but rather use the commonly named ld.<ALTERNATE_LINKER>
filename.
* Add a large comment with the various linker filenames
for reference.
* Change the tests to locate the given linker first as linkers
may or may not be present on host.
* Change the linker test properties to not throw but rather
return an optional.
// The ALTERNATE_LINKER is the 'name' of the linker not the executable name, clang will find the linker binary based on name passed via -fuse-ld, but we need to discover
1279
-
// its properties by executing the actual binary. On unix based oses the linkers are installed as ld.<name> on windows its <name>.exe
1278
+
// its properties by executing the actual binary. There is a common filename when the linker is not "ld" across all platforms using "ld.<ALTERNAME_LINKER>(.exe)"
1279
+
// macOS (Xcode SDK)
1280
+
// -----------------
1281
+
// ld
1282
+
// ld-classic
1283
+
//
1284
+
// macOS (Open Source)
1285
+
// -----------
1286
+
// ld.lld -> lld
1287
+
// ld64.lld -> lld
1288
+
// lld
1289
+
// lld-link -> lld
1290
+
//
1291
+
// Linux
1292
+
// ------
1293
+
// /usr/bin/ld -> aarch64-linux-gnu-ld
1294
+
// /usr/bin/ld.bfd -> aarch64-linux-gnu-ld.bfd
1295
+
// /usr/bin/ld.gold -> aarch64-linux-gnu-ld.gold
1296
+
// /usr/bin/ld.lld -> lld
1297
+
// /usr/bin/ld64.lld -> lld
1298
+
// /usr/bin/lld
1299
+
// /usr/bin/lld-link -> lld
1300
+
// /usr/bin/gold -> aarch64-linux-gnu-gold
1301
+
//
1302
+
// Windows
1303
+
// -------
1304
+
// ld.lld.exe
1305
+
// ld64.lld.exe
1306
+
// lld-link.exe
1307
+
// lld.exe
1308
+
// link.exe //In Visual Studio
1309
+
//
1310
+
// Note: On Linux you cannot invoke the llvm linker by the direct name for determining the version,
1311
+
// you need to use ld.<ALTERNATE_LINKER>
1280
1312
varlinkerPath=Path("ld")
1281
-
if alternateLinker !=""{
1282
-
linkerPath =
1283
-
switch producer.hostOperatingSystem {
1284
-
case.linux:Path("ld.\(alternateLinker)")
1285
-
case.windows:Path("\(alternateLinker).exe")
1286
-
default:Path("\(alternateLinker)")
1287
-
}
1313
+
if alternateLinker !="" && alternateLinker !="ld"{
returntry #require(defaultToolchain.executableSearchPaths.findExecutable(operatingSystem: core.hostOperatingSystem, basename:"link"),"couldn't find link in default toolchain")
270
+
if core.hostOperatingSystem !=.windows {
271
+
// Most unixes have a link executable, but that is not a linker
0 commit comments