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

[PATCH 2/2][XTF] build: silence GNU ld 2.39 warning about executable stacks


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 29 Sep 2022 12:04:51 +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=EWt8/wR54+6m0d8cbccRfiANwhiSiGr4J0UEGqibS/I=; b=dic2qwF78P09vq1QIhZqm7y8KhV98G2eww5D9cKuqP6VNvBm7+1Jhh0ROu7ZnKtn3eijKLE7MsiL5NnT/VbaUzv45U54dvYZhtk4j4/iu3X9U6EbWda/6udHrSsay1OdwFVrLu1XiuAZk+uEX89YtPV/8FFSi8Far6pHIkUsYONl+/1MlXMhki3YkuTFrTyw2SZaoJhPFubqiwwATrEp8gqH1Jb0uJWcu/BvFLGUa+7iJ5E1tSjjiYViWmYjgO6VmVgO8udiT/5xfFcK/kW44NJnUzrskMXX1+V4czOiB8PcyerqrxRMOqK2v9CrlHxnF4frGCedR41YwDon5r2irQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V2Tn76ELU8cJn9UBT/rIjizIiKI55V3cwJNa68nHPM0iruUv3R2fjq8XVWGTAryZsmgoPBmXjnofSNptRdl5LFMdjSYbeEBaMcBvYkKSjrDVW1m1V8TAoQsDgU64AMI1PTovUUIzVsynaZR24Uztq7V18QlYGkXApNsOOfrZeqlBpKVdSa+h2DiR5i6duvn2zCG8tedB5tC4JJJGq6Zyi/9E7bFXjycHld4fQGqFV9fKMxUiKE6eJrDNUBkZntAYqcUBl7l/8DH8PmI0TbXWRot9CFgDfab43vVNAYRW/OV7Gjei9xGEbdBUfEvy2PMvTfJ+980olAqo8tOpcmGwTw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 29 Sep 2022 10:04:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While for C files the compiler is supposed to arrange for emitting
respective information, for assembly sources we're responsible ourselves.

For the new use of cc-option to work we cannot pass -S to the compiler
anymore. We need the compiler to actually invoke the assembler, so switch
to using -c.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/build/common.mk
+++ b/build/common.mk
@@ -15,9 +15,11 @@ $(foreach env,$(HVM_ENVIRONMENTS),$(eval
 $(foreach env,$(32BIT_ENVIRONMENTS),$(eval $(env)_arch := x86_32))
 $(foreach env,$(64BIT_ENVIRONMENTS),$(eval $(env)_arch := x86_64))
 
+comma := ,
+
 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`" ]; \
+cc-option = $(shell if [ -z "`echo 'int p=1;' | $(CC) $(1) -c -o /dev/null -x 
c - 2>&1`" ]; \
                        then echo y; else echo n; fi)
 
 ld-option = $(shell if $(LD) -v $(1) >/dev/null 2>&1; then echo y; else echo 
n; fi)
@@ -25,11 +27,15 @@ ld-option = $(shell if $(LD) -v $(1) >/d
 # Disable PIE, but need to check if compiler supports it
 COMMON_CFLAGS-$(call cc-option,-no-pie) += -no-pie
 
+# Arrange for assembly files to have a proper .note.GNU-stack section added,
+# to silence warnings otherwise issued by GNU ld 2.39 and newer.
+COMMON_AFLAGS-$(call cc-option,-Wa$(comma)--noexecstack) += -Wa,--noexecstack
+
 # Suppress warnings about LOAD segments with RWX permissions, as what we build
 # aren't normal user-mode executables.
 LDFLAGS-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 
-COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__
+COMMON_AFLAGS := $(COMMON_FLAGS) -D__ASSEMBLY__ $(COMMON_AFLAGS-y)
 COMMON_CFLAGS := $(COMMON_FLAGS) $(COMMON_CFLAGS-y)
 COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g
 COMMON_CFLAGS += -fno-common -fno-asynchronous-unwind-tables 
-fno-strict-aliasing




 


Rackspace

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