From 30c4de2f8b779a079b35e56a16e60414b05a75c5 Mon Sep 17 00:00:00 2001 From: Robert Allan James Date: Sat, 1 Aug 2026 15:53:34 -0400 Subject: [PATCH] Fix aarch64 lld-link resolution in Makefile.starkernel The aarch64 loader link step hardcoded the unversioned "lld-link", which isn't on PATH by default on this Debian/Ubuntu setup (the package only installs lld-link-18 under /usr/bin; unversioned lld-link lives under /usr/lib/llvm-18/bin). CI worked around this with an explicit PATH prefix in the workflow; a local build without that PATH override failed. Now auto-detects whichever name resolves, falling back to the versioned name. Verified: aarch64 builds clean with the default PATH. Co-Authored-By: Claude Sonnet 5 --- Makefile.starkernel | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.starkernel b/Makefile.starkernel index 915f224..35c7738 100644 --- a/Makefile.starkernel +++ b/Makefile.starkernel @@ -139,7 +139,10 @@ else ifeq ($(ARCH),aarch64) endif # aarch64 loader uses clang + lld-link (COFF target — GCC cannot produce aarch64 PE) LOADER_CC := clang-18 - LOADER_LD := lld-link + # Debian/Ubuntu package only installs the versioned lld-link-18 on PATH by + # default (unversioned lld-link lives under /usr/lib/llvm-18/bin, which + # isn't on PATH unless explicitly prepended) — detect whichever resolves. + LOADER_LD := $(shell which lld-link 2>/dev/null || which lld-link-18 2>/dev/null || echo lld-link) ARCH_CFLAGS := -march=armv8-a -mcpu=cortex-a72 -DARCH_AARCH64 -mno-outline-atomics LOADER_LINKER_SCRIPT := linker/starkernel-loader-aarch64.ld KERNEL_LINKER_SCRIPT := linker/starkernel-kernel-aarch64.ld @@ -609,7 +612,7 @@ $(KERNEL_OBJ_DIR)/%.o: $(KERNEL_SRC)/%.S | $(KERNEL_OBJ_DIR) $(LOADER_EFI): $(LOADER_OBJS) | $(BUILD_DIR) ifeq ($(ARCH),aarch64) @echo "LLD-LINK (loader PE) $@" - @lld-link /subsystem:EFI_APPLICATION /entry:efi_main /nodefaultlib \ + @$(LOADER_LD) /subsystem:EFI_APPLICATION /entry:efi_main /nodefaultlib \ /align:4096 /base:0 /out:$@ $(LOADER_OBJS) @echo "Loader built: $@" else ifeq ($(ARCH),riscv64)