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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
76226dbaa2
commit
30c4de2f8b
+5
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user