From 5904c7afdf412db9e93ace7cb67ed2899a0d49e8 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 29 Sep 2022 12:04:28 +0200 Subject: [PATCH] build: suppress GNU ld 2.39 warning about RWX load segments 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 Reviewed-by: Andrew Cooper --- build/common.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/common.mk b/build/common.mk index 90c2169..63345b3 100644 --- a/build/common.mk +++ b/build/common.mk @@ -20,9 +20,15 @@ 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) +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 -- 2.39.5