[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] zap linking-only option from EMBEDDED_EXTRA_CFLAGS


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 9 Sep 2022 09:22:52 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w64Ecx1+8EL+wrspYIaDYT1Izwreh0mSF8hsvv4Kvz0=; b=UzQ1dvHbvqBiWQepYGmtPtlurjiVtQ9yj+GNChj7O9mOyZepTdDlZOoDzkYaGymIMJOPmIagbQlRcA72aO5qQi2L+xgRMEZs3dLvTgO0gZYSH+bDRTCWeW8wcDwds3OOhNYgVuOo8mU6ntIys6TUUHSjbTtkhcH5Dp/tY3T4Uw+sUUNt1ytdarzRQwNiMhx9w0waK7DULTWjZjoIlZRGnyFcQ0RKGDAWVCiVDWcPzAmdoLJlUtYDHJVPSyJlevMJFW06lzTTn/L1+E8IKcZ1sZC+k9KKmR65/+lIt1PBKxZJronwhaacm8EqXi3lwUCPg28301ZpZzweLU3hqmqAkg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EJQo4EkoYn85e1604VR5I8Gm3gV6slaHToBFyp0rBlo+8HggCCpoZnkvbuOovaTmlgCWs3SrsDJWIDTLeDheIgOTWq1uQJ4EswEbFEBu8XjAfnYUZGd+xKU+fQ0b8S1vqfTEdlPT+acTiV1aVFzA23BQlwcCPJKf68pFJDHp9YBd0OG7LN10tzWa+zQQlYxhIuxFjq91gFT4tYEgOxXTGqQiw0sWF6ocX98Z9wFjb0RfF18k3jhkURQAvtXCsCEhh8VY7X9RlNsMxgyOtQwmmq/tul5ue1vk0DVzQi2qOmvYy3lGTPqVlPE4ROBl0iUW9rf21eh4Y4d/JMn1LkqEtQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 07:23:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While I was suspicious of the compiler issuing a diagnostic about an
unused linking-only option when not doing any linking, I did check this
with a couple of gcc versions only, but not with Clang. (Oddly enough at
least older Clang versions complain about the use of '-nopie' now that
we actually use '-no-pie'.) Filter out the problematic option in all
cases where the variable is consumed for compilation only (which right
now is everywhere).

Fixes: ecd6b9759919 ("Config.mk: correct PIE-related option(s) in 
EMBEDDED_EXTRA_CFLAGS")
Reported-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Arguably with all users of EMBEDDED_EXTRA_CFLAGS using these just for
compiling, the option could be omitted from that variable right away.
But if any compile-and-link-in-one-go use appeared, there would be an
issue.

--- a/tools/firmware/Rules.mk
+++ b/tools/firmware/Rules.mk
@@ -13,7 +13,7 @@ endif
 
 CFLAGS += -Werror
 
-$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-options-add,CFLAGS,CC,$(filter-out -no-pie,$(EMBEDDED_EXTRA_CFLAGS)))
 
 $(call cc-option-add,CFLAGS,CC,-fcf-protection=none)
 
--- a/tools/tests/x86_emulator/testcase.mk
+++ b/tools/tests/x86_emulator/testcase.mk
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 CFLAGS :=
 include $(XEN_ROOT)/tools/Rules.mk
 
-$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-options-add,CFLAGS,CC,$(filter-out -no-pie,$(EMBEDDED_EXTRA_CFLAGS)))
 
 CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags)
 
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -1,7 +1,7 @@
 ########################################
 # arm-specific definitions
 
-$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-options-add,CFLAGS,CC,$(filter-out -no-pie,$(EMBEDDED_EXTRA_CFLAGS)))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 
 # Prevent floating-point variables from creeping into Xen.
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -10,7 +10,7 @@ CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFF
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
 
-$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-options-add,CFLAGS,CC,$(filter-out -no-pie,$(EMBEDDED_EXTRA_CFLAGS)))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX)
 $(call as-option-add,CFLAGS,CC,"crc32 %eax$$(comma)%eax",-DHAVE_AS_SSE4_2)
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -12,7 +12,7 @@ endif
 $(obj)/head.o: $(head-bin-objs:.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
-$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+$(call cc-options-add,CFLAGS_x86_32,CC,$(filter-out 
-no-pie,$(EMBEDDED_EXTRA_CFLAGS)))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
 ifdef building_out_of_srctree
 CFLAGS_x86_32 += -I$(objtree)/include



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.