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.