summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.mk3
-rwxr-xr-xutil/xcompile/xcompile6
2 files changed, 6 insertions, 3 deletions
diff --git a/Makefile.mk b/Makefile.mk
index e9ad2ccbb2..901d6b29c6 100644
--- a/Makefile.mk
+++ b/Makefile.mk
@@ -604,9 +604,6 @@ LDFLAGS_common += -nostdlib
LDFLAGS_common += --nmagic
LDFLAGS_common += -static
LDFLAGS_common += -z noexecstack
-# Disable warning on segments with RWX.
-# All loadable sections are placed in the same segment for simplicity.
-LDFLAGS_common += --no-warn-rwx-segments
# Workaround for RISC-V linker bug, merge back into above line when fixed.
# https://sourceware.org/bugzilla/show_bug.cgi?id=27180
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
index 4ead648305..13ed48be52 100755
--- a/util/xcompile/xcompile
+++ b/util/xcompile/xcompile
@@ -241,6 +241,12 @@ detect_special_flags() {
testcc "$GCC" "$CFLAGS_GCC -Wextra" &&
CFLAGS_GCC="$CFLAGS_GCC -Wextra"
+ # Disable warning on segments with RWX.
+ # All loadable sections are placed in the same segment for simplicity.
+ testld "$GCC" "$FLAGS_GCC" "${GCCPREFIX}ld${LINKER_SUFFIX}" \
+ "$LDFLAGS --no-warn-rwx-segments" && \
+ LDFLAGS="$LDFLAGS --no-warn-rwx-segments"
+
case "$architecture" in
x86)
;;