Patch-Source: https://github.com/crust-firmware/crust/commit/ade7ad311170b8a818741944d97489c887cd673f needed with new binutils (2.39+) -- From ade7ad311170b8a818741944d97489c887cd673f Mon Sep 17 00:00:00 2001 From: Nathan Rennie-Waldock Date: Sun, 15 Jan 2023 10:16:08 +0000 Subject: [PATCH] Makefile: Fix build with binutils 2.39 and newer Conditionally pass --no-warn-rwx-segments to ld to silence an irrelevant warning about segment permissions. Fixes #207 Signed-off-by: Nathan Rennie-Waldock [Samuel: simplifications; expanded commit message] Signed-off-by: Samuel Holland --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2f6b707a..ae559947 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ HOSTCC = $(HOST_COMPILE)gcc AR = $(CROSS_COMPILE)gcc-ar CC = $(CROSS_COMPILE)gcc +LD = $(shell $(CC) -print-prog-name=ld) OBJCOPY = $(CROSS_COMPILE)objcopy LEX = lex @@ -83,7 +84,10 @@ LDFLAGS = -nostdlib \ -Wl,--fatal-warnings \ -Wl,--gc-sections \ -Wl,--no-dynamic-linker \ - -Wl,--no-undefined + -Wl,--no-undefined \ + $(call ld-option,--no-warn-rwx-segments) + +ld-option = $(shell $(LD) -v $1 >/dev/null 2>&1 && printf '%s' '-Wl,$1') ###############################################################################