authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-26 16:51:16+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-27 14:09:05+02:00
log3e7708b02b48595f004083b17a05363d9fb2fa57
tree1da8e3e8046575d97a67df310609ffcff55046a2
parentb16c094926cf659e144cbcbed6c69cd820c5ff9f
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

link.Elf: Skip invoking LLD for `zig build-obj` for unsupported targets.

LLD doesn't support these yet. Doing this hack will at least allow basic experimentation for these targets.

1 files changed, 12 insertions(+), 1 deletions(-)

src/link/Elf.zig+12-1
......@@ -1663,7 +1663,18 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
16631663 // copy when generating relocatables. Normally, we would expect `lld -r` to work.
16641664 // However, because LLD wants to resolve BPF relocations which it shouldn't, it fails
16651665 // before even generating the relocatable.
1666 if (output_mode == .Obj and (comp.config.lto != .none or target.cpu.arch.isBpf())) {
1666 //
1667 // For m68k, we go through this path because LLD doesn't support it yet, but LLVM can
1668 // produce usable object files.
1669 if (output_mode == .Obj and
1670 (comp.config.lto != .none or
1671 target.cpu.arch.isBpf() or
1672 target.cpu.arch == .lanai or
1673 target.cpu.arch == .m68k or
1674 target.cpu.arch.isSPARC() or
1675 target.cpu.arch == .ve or
1676 target.cpu.arch == .xcore))
1677 {
16671678 // In this case we must do a simple file copy
16681679 // here. TODO: think carefully about how we can avoid this redundant operation when doing
16691680 // build-obj. See also the corresponding TODO in linkAsArchive.