diff mbox series

[1/2,XTF] build: suppress GNU ld 2.39 warning about RWX load segments

Message ID 4868cc00-428c-a315-1a5e-cada97957bde@suse.com (mailing list archive)
State New, archived
Headers show
Series build: suppress GNU ld 2.39 warnings | expand

Commit Message

Jan Beulich Sept. 29, 2022, 10:04 a.m. UTC
We cannot really avoid such and we're also not really at risk because of
them, as we control page table permissions ourselves rather than relying
on a loader of some sort.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

--- a/build/common.mk
+++ b/build/common.mk
@@ -20,9 +20,15 @@  COMMON_FLAGS := -pipe -I$(ROOT)/include
 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)
 
+ld-option = $(shell if $(LD) -v $(1) >/dev/null 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
 
+# 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_CFLAGS := $(COMMON_FLAGS) $(COMMON_CFLAGS-y)
 COMMON_CFLAGS += -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g