From: Andrew Cooper Date: Mon, 19 Apr 2021 15:06:38 +0000 (+0100) Subject: build: Use LD X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8486a388e2244c99cbfe61c3fcde402c3731a8b8;p=xtf.git build: Use LD This is going to matter for proper LLVM support, where we want to default to ld.lld Signed-off-by: Andrew Cooper --- diff --git a/Makefile b/Makefile index 15a865f..ae6124e 100644 --- a/Makefile +++ b/Makefile @@ -23,16 +23,16 @@ export DESTDIR xtfdir xtftestdir # Programs used CC := $(CROSS_COMPILE)gcc +LD := $(CROSS_COMPILE)ld +OBJCOPY := $(CROSS_COMPILE)objcopy CPP := $(CC) -E INSTALL := install INSTALL_DATA := $(INSTALL) -m 644 -p INSTALL_DIR := $(INSTALL) -d -p INSTALL_PROGRAM := $(INSTALL) -p -# LD := $(CC) # Use $(CC) for linking to support LTO -OBJCOPY := $(CROSS_COMPILE)objcopy PYTHON := python -export CC CPP INSTALL INSTALL_DATA INSTALL_DIR INSTALL_PROGRAM OBJCOPY PYTHON +export CC LD CPP INSTALL INSTALL_DATA INSTALL_DIR INSTALL_PROGRAM OBJCOPY PYTHON .PHONY: all all: diff --git a/build/common.mk b/build/common.mk index e43dd62..1f04880 100644 --- a/build/common.mk +++ b/build/common.mk @@ -57,7 +57,7 @@ CFLAGS_$(1) := $$(CFLAGS_$($(1)_arch)) $$(COMMON_CFLAGS-$(1)) -DCONFIG_ENV_$(1) head-$(1) := $(ROOT)/arch/x86/$($(1)_guest)/head-$(1).o link-$(1) := $(ROOT)/arch/x86/link-$(1).lds -LDFLAGS_$(1) := -Wl,-T,$$(link-$(1)) -nostdlib $(LDFLAGS-y) +LDFLAGS_$(1) := -T $$(link-$(1)) -nostdlib $(LDFLAGS-y) # Needs to pick up test-provided obj-perenv and obj-perarch DEPS-$(1) = $$(head-$(1)) \ diff --git a/build/gen.mk b/build/gen.mk index f657d87..25dd5c6 100644 --- a/build/gen.mk +++ b/build/gen.mk @@ -51,11 +51,11 @@ define PERENV_build ifneq ($(1),hvm64) # Generic link line for most environments test-$(1)-$(NAME): $$(DEPS-$(1)) $$(link-$(1)) - $(CC) $$(LDFLAGS_$(1)) $$(DEPS-$(1)) -o $$@ + $(LD) $$(LDFLAGS_$(1)) $$(DEPS-$(1)) -o $$@ else # hvm64 needs linking normally, then converting to elf32-x86-64 or elf32-i386 test-$(1)-$(NAME): $$(DEPS-$(1)) $$(link-$(1)) - $(CC) $$(LDFLAGS_$(1)) $$(DEPS-$(1)) -o $$@.tmp + $(LD) $$(LDFLAGS_$(1)) $$(DEPS-$(1)) -o $$@.tmp $(OBJCOPY) $$@.tmp -O $(hvm64-format) $$@ rm -f $$@.tmp endif