1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 11:45:18 +03:00
aports/testing/crust/binutils-2.39.patch
2023-06-21 03:16:46 +02:00

44 lines
1.4 KiB
Diff

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 <nathan.renniewaldock@gmail.com>
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 <nathan.renniewaldock@gmail.com>
[Samuel: simplifications; expanded commit message]
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
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')
###############################################################################