From patchwork Mon Aug 5 21:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=2E_Neusch=C3=A4fer?= X-Patchwork-Id: 1969255 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd9FC61dKz1ybS for ; Tue, 6 Aug 2024 07:54:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0E21F40257; Mon, 5 Aug 2024 21:54:05 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id uWrSIPa8ejpb; Mon, 5 Aug 2024 21:54:04 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C0D7240258 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id C0D7240258; Mon, 5 Aug 2024 21:54:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 3E8B51BF2E4 for ; Mon, 5 Aug 2024 21:54:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2C4A46076F for ; Mon, 5 Aug 2024 21:54:03 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gSvn53o3auR6 for ; Mon, 5 Aug 2024 21:54:02 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.17.22; helo=mout.gmx.net; envelope-from=j.neuschaefer@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org A586E6064B DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A586E6064B Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by smtp3.osuosl.org (Postfix) with ESMTPS id A586E6064B for ; Mon, 5 Aug 2024 21:54:01 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from probook ([87.78.127.77]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MtfJX-1sN8Ab27up-012yTt; Mon, 05 Aug 2024 23:53:58 +0200 Date: Mon, 05 Aug 2024 23:53:56 +0200 MIME-Version: 1.0 Message-Id: <20240805-z-linker-v1-1-8362e6645f67@gmx.net> X-B4-Tracking: v=1; b=H4sIAPNJsWYC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDCwNT3SrdnMy87NQiXTOLVCOjtOQkY2MLCyWg8oKi1LTMCrBR0bG1tQC C42g7WgAAAA== To: buildroot@buildroot.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722894838; l=1931; i=j.neuschaefer@gmx.net; s=20240329; h=from:subject:message-id; bh=5ZLQbtq6LbRlFqDU9avi7MBv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u7ySiLSIq4RkfsWqLDz8x1SwIu2bebaG9Z7/FYaDB4 Pg26ddd3vtHS3+hkTe3B9MHNbu0WMjnw113CAuHiImoCdzJfWJGWV3sehWPoFG6CHAGiGp+Ez u6Qi79Bp4Wdb4f5vZq/MTKhs3IpEszhIlx2gTBelbDhUVHm7fe7Wpti+j9lPMjvISWXw5x0uW /5mNovDpGqE0QyBb5hq6D+AhBP0/sRKpo4LTw4pero/TtSoRQBZj38fR0taPnc60ansbwkRTj F1FWUawyIKGdOafIR5bb/WWA== X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1722894838; x=1723499638; i=j.neuschaefer@gmx.net; bh=0cyhUqNSn5UeQ+mr22eyL+uB3V2FebfipOx/d+LLiEM=; h=X-UI-Sender-Class:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:To:Cc:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=d93EqFwmwJXzw1S/yoAVpkIcXYGn93jkzQPgU37uo6TP58WkM9iXSuwDMRmMZKjT nT9hLd/yg7+nxn+JWsIGf/FnqKPtjpt/EnNO9RYJsfo88P8LEMh+U7/qlQcpMdNkz GA42dlYZmLRJU5G5nIFmfp6iDAAAKdxII6K9igcTbEOFzmvRWeZFqNERLT7Sqrcxw MEnJWczG4mNCU+9Z+vY+87YW9fbEA0aLD6Z+QFbVzRqucMIDTEWFLLsQEaUXvJAaF 4Tb1av7EN77Wnv2o5WdyUoQGeGv5trGsYdSxmcbqk3EmXLyVifQX2r8GGMus5yT+L qgybN71w6Y0jStncOg== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=j.neuschaefer@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=d93EqFwm Subject: [Buildroot] [PATCH] package/Makefile.in: Use "-z text" instead of "-Wl, -z, text" X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?J=2E_Neusch=C3=A4fer_via_buildroot?= From: =?utf-8?q?J=2E_Neusch=C3=A4fer?= Reply-To: =?utf-8?q?J=2E_Neusch=C3=A4fer?= Cc: =?utf-8?q?J=2E_Neusch=C3=A4fer?= , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" 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 --- Note: This patch is inspired by gnu-efi, which passes TARGET_LDFLAGS directly to ld. This particular case is solved by this patch, but gnu-efi then fails differently (on ARM), with errors such as: /.../per-package/gnu-efi/host/bin/arm-buildroot-linux-musleabi-ld: buildroot/build/gnu-efi-3.0.18/arm/lib/../../lib/print.c:1431:(.text+0x78c): undefined reference to `__aeabi_i2d' --- package/Makefile.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- base-commit: f9f2ade9bb207d2481b12a325bba7cee5a3e9cbf change-id: 20240805-z-linker-68e22fcb3388 Best regards, -- J. Neuschäfer 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.