瀏覽代碼

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>
J. Neuschäfer 1 年之前
父節點
當前提交
bd035872be
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      package/Makefile.in

+ 6 - 1
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.