From bd035872be9948515ee50ae034bda4a2e044ff22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Mon, 5 Aug 2024 23:53:56 +0200 Subject: [PATCH] package/Makefile.in: Use "-z text" instead of "-Wl, -z, text" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the recent addition to -Wl,-z,text to TARGET_LDFLAGS in case of musl-libc and dynamic linking, it was found that some packages pass TARGET_LDFLAGS directly to ld, but the -Wl syntax only works with compiler drivers (gcc/clang). This commit changes the flag to -z text, which the gcc and clang also understand and pass to the linker. Reported-by: Thomas Petazzoni Signed-off-by: J. Neuschäfer Signed-off-by: Thomas Petazzoni --- package/Makefile.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/Makefile.in b/package/Makefile.in index 1cedfefa7e..43a5c279c0 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -154,8 +154,13 @@ TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS)) # when DT_TEXREL is used, so we capture the problem earlier. # # See also: https://www.openwall.com/lists/musl/2020/09/25/4 +# +# NOTE: We're using "-z text" instead of "-Wl,-z,text" here, because some +# packages pass TARGET_LDFLAGS directly to ld rather than gcc, and ld doesn't +# support -Wl,[...]. -z is supported by both gcc and clang, so it probably +# won't cause us problems. ifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_STATIC_LIBS),y:) -TARGET_LDFLAGS += -Wl,-z,text +TARGET_LDFLAGS += -z text endif # By design, _FORTIFY_SOURCE requires gcc optimization to be enabled.