From patchwork Sun Aug 11 09:04:38 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: 1971247 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=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::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 4WhWvQ3Lcqz1yYl for ; Sun, 11 Aug 2024 19:05:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5CF2540711; Sun, 11 Aug 2024 09:05:19 +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 iwRn5d6ixZD2; Sun, 11 Aug 2024 09:05:18 +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 085124071C Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 085124071C; Sun, 11 Aug 2024 09:05:18 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DA4231BF2AA for ; Sun, 11 Aug 2024 09:05:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D546C80E8A for ; Sun, 11 Aug 2024 09:05:15 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id CihiDXXbRIqg for ; Sun, 11 Aug 2024 09:05:14 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.17.21; helo=mout.gmx.net; envelope-from=j.neuschaefer@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org BE07680E56 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org BE07680E56 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by smtp1.osuosl.org (Postfix) with ESMTPS id BE07680E56 for ; Sun, 11 Aug 2024 09:05:12 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from probook ([89.0.46.195]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4axq-1seiOp1kQA-003fyT; Sun, 11 Aug 2024 11:04:53 +0200 Date: Sun, 11 Aug 2024 11:04:38 +0200 MIME-Version: 1.0 Message-Id: <20240811-microblaze-v1-1-2781ba343e75@gmx.net> X-B4-Tracking: v=1; b=H4sIAKV+uGYC/x3MTQqAIBBA4avErBMciZKuEi2sxhrwJxQiku6et PwW7xXIlJgyjE2BRBdnjqEC2wbWw4SdBG/VoKTqpEYUntcUF2ceEtpabXqFQzcg1OBMZPn+ZxO 4yyuY3/cDl4LOmWIAAAA= To: lvm-devel@lists.linux.dev X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723367092; l=2401; i=j.neuschaefer@gmx.net; s=20240329; h=from:subject:message-id; bh=/jI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xSDxwLnWrWnDGJOn1pxNp6VHSvzYOPfpFqQVY9Mb0i/KPFP8+VZRwWlntz496gri3fw EcsxpArJ5tPtsVsDkHUKHnNmrmGHP69Y1yH8VkcW8RzfoT9wsXOoOsW73YWH2W+m6ENQSRWWf icwsPxZK5Pt2QT94wbZG+rMWPJXr5o5RV1T9kynStAnCji3erwBX6NxQl21hWrU2jLNobun4B fYrCWanNWTBVPj6VkKm1JFDUtLO/JRbaLaskAXlo15NGIEiC69ce3LDBN+eLDAazJumMjK4Hy ngPYKzLEGPFoNs/OoNUx0fvg== X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1723367093; x=1723971893; i=j.neuschaefer@gmx.net; bh=PQoK75LGskjImgHPQvMqpAYAVpmyezFeIkSz//GmB+g=; 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=ScCpvPN0vllp5kHLS68qLVRljJ/LwHaCbg/dThlyHLqomA/ssMA9qSoc29mOtYCp LFlbu5EYepNqHFu4vWG7aJPdpLTyGRAPwU/H4zXdO62Rs50NKws66X9cnPyw41m92 NqTW43A+dWvqIxlO81o48r5AnjClOn6CwLkf/5bixVIiWOK2iZRP2M0BUsS2q7C/M QgCuh5ZFAZgR6DYIEgPw8DKK5+xc9YuZu6f64q+HmJXHb+danwN5NcZpFX17Lr/0N aPoIp3UQw3o+5oQldYEnvrR85rPkaR8LjJ8NWH/RneSCYOFToSZf28d2nG3j+aIU4 +M8zoLnXhqoELPC2hg== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmx.net header.i=j.neuschaefer@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=ScCpvPN0 Subject: [Buildroot] [PATCH lvm2] acinclude.m4: Link when trying CCFLAGS 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: musl@lists.openwall.com, =?utf-8?q?J=2E_Neusch=C3=A4fer?= , buildroot@buildroot.org Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Through a build failure of LVM2 on musl-libc 1.2.5 in the Buildroot autobuild service[1], I noticed that musl-libc's Scrt1 for microblaze produces a relocation targeting the .text section, which subsequently leads to a crash at run-time because musl-libc does not support textrels[2]. Buildroot uses the "-z text" linker option to catch textrels early, on musl-libc. The error can be reduced to the following test case: $ cat hello.c #include int main(void) { puts("Hello world!"); return 0; } $ host/bin/microblaze-buildroot-linux-musl-gcc hello.c -z text -pie -fPIC microblaze-buildroot-linux-musl/bin/ld: microblaze-buildroot-linux-musl/sysroot/lib/Scrt1.o: warning: relocation against `_start_c' in read-only section `.text' microblaze-buildroot-linux-musl/bin/ld: read-only segment has dynamic relocations collect2: error: ld returned 1 exit status LVM2 uses -pie only after the AC_TRY_CCFLAG macro has determined that it can be used. This is where the problem begins: AC_TRY_CCFLAG only tries compiling, it does not try linking the resulting object file. To catch problems like this, this patch changes AC_TRY_CCFLAG to link in addition to compiling. By detecting correctly that -pie does not work on musl-libc/microblaze with -ztext, the build failure in Buildroot is fixed. [1]: http://autobuild.buildroot.net/results/dc4/dc4fc33eaeafe5d6707d26a373560402533954f6/build-end.log [2]: https://www.openwall.com/lists/musl/2020/09/25/4 Signed-off-by: J. Neuschäfer --- Hi, I'm cross-posting this to the LVM2, Buildroot, and musl mailing lists to get potential feedback early on. --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- base-commit: 90a845a7087478a7cdc7a60d89d2e7ee1366160e change-id: 20240811-microblaze-8ff8a6217471 Best regards, -- J. Neuschäfer diff --git a/acinclude.m4 b/acinclude.m4 index 47fdd59c3..9b1d3a605 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -25,7 +25,7 @@ AC_DEFUN([AC_TRY_CCFLAG], ac_save_CFLAGS=$CFLAGS CFLAGS=$1 AC_CACHE_CHECK([whether $CC accepts $1 flag], [ac_cv_flag_$2], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AC_LINK_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET([ac_cv_flag_$2], [yes])], [AS_VAR_SET([ac_cv_flag_$2], [no])])]) CFLAGS=$ac_save_CFLAGS