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

[mini-os master] build: silence GNU ld 2.39 warning about executable stacks



commit 9c20bc009c907001efcd590a796ed67068f09b92
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Nov 2 08:25:59 2023 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Nov 2 08:25:59 2023 +0100

    build: silence GNU ld 2.39 warning about executable stacks
    
    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>
    Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 Config.mk | 6 ++++--
 minios.mk | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Config.mk b/Config.mk
index 677e93d..bfdf885 100644
--- a/Config.mk
+++ b/Config.mk
@@ -1,4 +1,6 @@
-#
+# Convenient variables
+comma := ,
+
 # Compare $(1) and $(2) and replace $(2) with $(1) if they differ
 #
 # Typically $(1) is a newly generated file and $(2) is the target file
@@ -20,7 +22,7 @@ endef
 #
 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
 cc-option = $(shell if test -z "`echo 'void*p=1;' | \
-              $(1) $(2) -S -o /dev/null -x c - 2>&1 | grep -- $(2) -`"; \
+              $(1) $(2) -c -o /dev/null -x c - 2>&1 | grep -- $(2) -`"; \
               then echo "$(2)"; else echo "$(3)"; fi ;)
 
 ifneq ($(MINIOS_CONFIG),)
diff --git a/minios.mk b/minios.mk
index ef4d2f9..f718ee6 100644
--- a/minios.mk
+++ b/minios.mk
@@ -28,6 +28,10 @@ endif
 # Make the headers define our internal stuff
 DEF_CFLAGS += -D__INSIDE_MINIOS__
 
+# 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.
+DEF_ASFLAGS += $(call cc-option,$(CC),-Wa$(comma)--noexecstack)
+
 # Build the CFLAGS and ASFLAGS for compiling and assembling.
 # DEF_... flags are the common mini-os flags,
 # ARCH_... flags may be defined in arch/$(TARGET_ARCH_FAM/rules.mk
--
generated by git-patchbot for /home/xen/git/mini-os.git#master



 


Rackspace

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