package/Makefile.in: Use "-z text" instead of "-Wl, -z, text"

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 <thomas.petazzoni@bootlin.com>
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
J. Neuschäfer
2024-08-05 23:53:56 +02:00
committed by Thomas Petazzoni
parent beb54d8126
commit bd035872be
+6 -1
View File
@@ -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.