| ... | @@ -483,6 +483,16 @@ pub const Target = struct { | ... | @@ -483,6 +483,16 @@ pub const Target = struct { |
| 483 | else => false, | 483 | else => false, |
| 484 | }; | 484 | }; |
| 485 | } | 485 | } |
| | 486 | |
| | 487 | pub fn floatAbi(abi: Abi) FloatAbi { |
| | 488 | return switch (abi) { |
| | 489 | .gnueabihf, |
| | 490 | .eabihf, |
| | 491 | .musleabihf, |
| | 492 | => .hard, |
| | 493 | else => .soft, |
| | 494 | }; |
| | 495 | } |
| 486 | }; | 496 | }; |
| 487 | | 497 | |
| 488 | pub const ObjectFormat = enum { | 498 | pub const ObjectFormat = enum { |
| ... | @@ -1259,13 +1269,7 @@ pub const Target = struct { | ... | @@ -1259,13 +1269,7 @@ pub const Target = struct { |
| 1259 | }; | 1269 | }; |
| 1260 | | 1270 | |
| 1261 | pub fn getFloatAbi(self: Target) FloatAbi { | 1271 | pub fn getFloatAbi(self: Target) FloatAbi { |
| 1262 | return switch (self.abi) { | 1272 | return self.abi.floatAbi(); |
| 1263 | .gnueabihf, | | |
| 1264 | .eabihf, | | |
| 1265 | .musleabihf, | | |
| 1266 | => .hard, | | |
| 1267 | else => .soft, | | |
| 1268 | }; | | |
| 1269 | } | 1273 | } |
| 1270 | | 1274 | |
| 1271 | pub fn hasDynamicLinker(self: Target) bool { | 1275 | pub fn hasDynamicLinker(self: Target) bool { |
| ... | @@ -1336,12 +1340,12 @@ pub const Target = struct { | ... | @@ -1336,12 +1340,12 @@ pub const Target = struct { |
| 1336 | const print = S.print; | 1340 | const print = S.print; |
| 1337 | const copy = S.copy; | 1341 | const copy = S.copy; |
| 1338 | | 1342 | |
| 1339 | if (self.isAndroid()) { | 1343 | if (self.abi == .android) { |
| 1340 | const suffix = if (self.cpu.arch.ptrBitWidth() == 64) "64" else ""; | 1344 | const suffix = if (self.cpu.arch.ptrBitWidth() == 64) "64" else ""; |
| 1341 | return print(&result, "/system/bin/linker{}", .{suffix}); | 1345 | return print(&result, "/system/bin/linker{}", .{suffix}); |
| 1342 | } | 1346 | } |
| 1343 | | 1347 | |
| 1344 | if (self.isMusl()) { | 1348 | if (self.abi.isMusl()) { |
| 1345 | const is_arm = switch (self.cpu.arch) { | 1349 | const is_arm = switch (self.cpu.arch) { |
| 1346 | .arm, .armeb, .thumb, .thumbeb => true, | 1350 | .arm, .armeb, .thumb, .thumbeb => true, |
| 1347 | else => false, | 1351 | else => false, |
| ... | @@ -1351,7 +1355,7 @@ pub const Target = struct { | ... | @@ -1351,7 +1355,7 @@ pub const Target = struct { |
| 1351 | .armeb, .thumbeb => "armeb", | 1355 | .armeb, .thumbeb => "armeb", |
| 1352 | else => |arch| @tagName(arch), | 1356 | else => |arch| @tagName(arch), |
| 1353 | }; | 1357 | }; |
| 1354 | const arch_suffix = if (is_arm and self.getFloatAbi() == .hard) "hf" else ""; | 1358 | const arch_suffix = if (is_arm and self.abi.floatAbi() == .hard) "hf" else ""; |
| 1355 | return print(&result, "/lib/ld-musl-{}{}.so.1", .{ arch_part, arch_suffix }); | 1359 | return print(&result, "/lib/ld-musl-{}{}.so.1", .{ arch_part, arch_suffix }); |
| 1356 | } | 1360 | } |
| 1357 | | 1361 | |
| ... | @@ -1373,7 +1377,7 @@ pub const Target = struct { | ... | @@ -1373,7 +1377,7 @@ pub const Target = struct { |
| 1373 | .armeb, | 1377 | .armeb, |
| 1374 | .thumb, | 1378 | .thumb, |
| 1375 | .thumbeb, | 1379 | .thumbeb, |
| 1376 | => return copy(&result, switch (self.getFloatAbi()) { | 1380 | => return copy(&result, switch (self.abi.floatAbi()) { |
| 1377 | .hard => "/lib/ld-linux-armhf.so.3", | 1381 | .hard => "/lib/ld-linux-armhf.so.3", |
| 1378 | else => "/lib/ld-linux.so.3", | 1382 | else => "/lib/ld-linux.so.3", |
| 1379 | }), | 1383 | }), |
| ... | @@ -1444,13 +1448,15 @@ pub const Target = struct { | ... | @@ -1444,13 +1448,15 @@ pub const Target = struct { |
| 1444 | => return result, | 1448 | => return result, |
| 1445 | }, | 1449 | }, |
| 1446 | | 1450 | |
| 1447 | // Operating systems in this list have been verified as not having a standard | | |
| 1448 | // dynamic linker path. | | |
| 1449 | .freestanding, | | |
| 1450 | .ios, | 1451 | .ios, |
| 1451 | .tvos, | 1452 | .tvos, |
| 1452 | .watchos, | 1453 | .watchos, |
| 1453 | .macos, | 1454 | .macos, |
| | 1455 | => return copy(&result, "/usr/lib/dyld"), |
| | 1456 | |
| | 1457 | // Operating systems in this list have been verified as not having a standard |
| | 1458 | // dynamic linker path. |
| | 1459 | .freestanding, |
| 1454 | .uefi, | 1460 | .uefi, |
| 1455 | .windows, | 1461 | .windows, |
| 1456 | .emscripten, | 1462 | .emscripten, |