| author | |
| committer | |
| log | 82d389279cad3773d456860a5eedca494d301f9b |
| tree | bc755a4fa575be4f400d1784a7053957a121ddc8 |
| parent | 9101d0395e28053a8cbceac40821afd15db127d3 |
| signature | Commit is signed but in an unrecognized format. |
`Elf2` is now a more complete linker implementation than LLD when
targeting sparc64 on ELF. For instance, LLD is essentially incapable of
building code which links against glibc on `sparc64-linux`, while `Elf2`
can handle that just fine.2 files changed, 19 insertions(+), 0 deletions(-)
src/Compilation/Config.zig+8| ... | ... | @@ -413,6 +413,12 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 413 | 413 | // assume no LLD. |
| 414 | 414 | if (options.use_new_linker == true) break :b false; |
| 415 | 415 | |
| 416 | if (options.use_new_linker == null and | |
| 417 | target_util.preferNewLinkerOverLld(target)) | |
| 418 | { | |
| 419 | break :b false; | |
| 420 | } | |
| 421 | ||
| 416 | 422 | // If we have no zig code to compile, no need for the self-hosted linker. |
| 417 | 423 | if (!options.have_zcu) break :b true; |
| 418 | 424 | |
| ... | ... | @@ -448,6 +454,8 @@ pub fn resolve(options: Options) ResolveError!Config { |
| 448 | 454 | |
| 449 | 455 | if (options.use_new_linker) |x| break :b x; |
| 450 | 456 | |
| 457 | if (target_util.preferNewLinkerOverLld(target)) break :b true; | |
| 458 | ||
| 451 | 459 | break :b options.incremental; |
| 452 | 460 | }; |
| 453 | 461 |
src/target.zig+11| ... | ... | @@ -285,6 +285,17 @@ pub fn hasLldSupport(ofmt: std.Target.ObjectFormat) bool { |
| 285 | 285 | }; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | pub fn preferNewLinkerOverLld(target: *const std.Target) bool { | |
| 289 | return switch (target.ofmt) { | |
| 290 | .elf => switch (target.cpu.arch) { | |
| 291 | // Elf2 is more complete than LLD on these targets. | |
| 292 | .sparc64 => true, | |
| 293 | else => false, | |
| 294 | }, | |
| 295 | else => false, | |
| 296 | }; | |
| 297 | } | |
| 298 | ||
| 288 | 299 | /// Returns `true` if `ofmt` has two linker implementations, so `-fnew-linker` is meaningful. |
| 289 | 300 | pub fn hasNewLinker(ofmt: std.Target.ObjectFormat) bool { |
| 290 | 301 | return switch (ofmt) { |