]> xenbits.xensource.com Git - people/aperard/xtf.git/commitdiff
build: Fix build with binutils 2.36
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 May 2021 09:48:57 +0000 (10:48 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 May 2021 10:01:04 +0000 (11:01 +0100)
Passing -no-pie to ld has never been correct, and binutils 2.36 now objects
properly to it.  https://sourceware.org/bugzilla/show_bug.cgi?id=27050

When this workaround was introduced, we used $(CC) to link, but this was
adjusted back to $(LD) with c/s 8486a388e2 ("build: Use LD").

However, the adjustment should always have been passed to the compile step,
not the link step.  Move the adjustment into COMMON_CFLAGS.

Fixes: c92015f8ab ("build: disable PIE during linking if necessary")
Fixes: 8486a388e2 ("build: Use LD")
Reported-by: Damien Thenot <damien.thenot@vates.fr>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
build/common.mk

index 1f048802124781f029fda38ee2f02d589b7e8056..886f190a0b109ec17aee69437cac463d24eac77e 100644 (file)
@@ -17,6 +17,12 @@ $(foreach env,$(64BIT_ENVIRONMENTS),$(eval $(env)_arch := x86_64))
 
 COMMON_FLAGS := -pipe -I$(ROOT)/include -I$(ROOT)/arch/x86/include -MMD -MP
 
+cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -S -o /dev/null -x c - 2>&1`" ]; \
+                       then echo y; else echo n; fi)
+
+# Disable PIE, but need to check if compiler supports it
+COMMON_CFLAGS-$(call cc-option,-no-pie) += -no-pie
+
 COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__
 COMMON_CFLAGS := $(COMMON_FLAGS) $(COMMON_CFLAGS-y)
 COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g
@@ -38,13 +44,6 @@ obj-perarch :=
 obj-perenv  :=
 include $(ROOT)/build/files.mk
 
-
-cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -S -o /dev/null -x c - 2>&1`" ]; \
-                       then echo y; else echo n; fi)
-
-# Disable PIE, but need to check if compiler supports it
-LDFLAGS-$(call cc-option,-no-pie) += -no-pie
-
 # Run once per environment to set up some common bits & pieces
 define PERENV_setup