From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8A88115808A for ; Wed, 23 Jul 2025 22:36:16 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 75E72340DCB for ; Wed, 23 Jul 2025 22:36:16 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 6EE6311055F; Wed, 23 Jul 2025 22:36:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 621C111055E for ; Wed, 23 Jul 2025 22:36:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 05DF9340E69 for ; Wed, 23 Jul 2025 22:36:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 48AC632A0 for ; Wed, 23 Jul 2025 22:36:13 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1753310156.d04a78e0813974c43508a20c0d2b9ea687ef162d.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/tests/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/tests/dot-a.sh X-VCS-Directories: eclass/tests/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: d04a78e0813974c43508a20c0d2b9ea687ef162d X-VCS-Branch: master Date: Wed, 23 Jul 2025 22:36:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a0e514d0-3efb-4980-9cdc-74a3d7539e46 X-Archives-Hash: 8cb5ca84cad1d9c93ef185a1a52658fb commit: d04a78e0813974c43508a20c0d2b9ea687ef162d Author: Sam James gentoo org> AuthorDate: Wed Jul 23 22:31:54 2025 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jul 23 22:35:56 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d04a78e0 eclass/tests: dot-a: check if strip dies on LLVM LTO archives Bug: https://sourceware.org/PR33198 Signed-off-by: Sam James gentoo.org> eclass/tests/dot-a.sh | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh index 8a5e4739b1fa..dd68bc00eeaf 100755 --- a/eclass/tests/dot-a.sh +++ b/eclass/tests/dot-a.sh @@ -458,6 +458,61 @@ test_strip_lto() { tend ${ret} "strip operated on a fat LTO archive when it shouldn't" } +test_strip_lto_mixed() { + # This is more of a test for https://sourceware.org/PR33198. + # It'll only happen in a Gentoo packaging context if a package + # uses Clang for some parts of the build or similar. + if ! type -P gcc &>/dev/null || ! type -P clang &>/dev/null ; then + return + fi + + # If we have a static archive with Clang LTO members, does strip + # error out wrongly, or does it work? Note that this can only + # happen in a mixed build because strip-lto-bytecode checks for + # the toolchain type before deciding which strip to use. + tbegin "whether strip accepts a Clang IR archive" + ret=0 + ( + export CFLAGS="-O2 -flto" + + rm test.a 2>/dev/null + + clang ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) q test.a a.o 2>/dev/null || return 1 + + # Pretend that gcc built a.o/test.a so that we use + # GNU Binutils strip to trigger the bug. + CC=gcc strip-lto-bytecode test.a || return 1 + + return 0 + ) || ret=1 + tend ${ret} "strip did not accept a Clang IR archive" + + # If we have a static archive with Clang fat LTO members, can we link + # against the stripped archive? + # Note that this can only happen in a mixed build because strip-lto-bytecode + # checks for the toolchain type before deciding which strip to use. + tbegin "whether strip corrupts a Clang fat IR archive" + ret=0 + ( + export CFLAGS="-O2 -flto" + + lto-guarantee-fat + + rm test.a 2>/dev/null + + clang ${CFLAGS} a.c -o a.o -c 2>/dev/null || return 1 + $(tc-getAR) q test.a a.o 2>/dev/null || return 1 + + # Pretend that gcc built a.o/test.a so that we use + # GNU Binutils strip to trigger the bug. + CC=gcc strip-lto-bytecode test.a || return 1 + + clang ${CFLAGS} ${LDFLAGS} -fno-lto main.c test.a -o main || return 1 + ) || ret=1 + tend ${ret} "strip corrupted a Clang IR archive, couldn't link against the result" +} + test_strip_nolto() { # Check whether regular (non-LTO'd) static libraries are stripped # and not ignored (bug #957882, https://sourceware.org/PR33078). @@ -565,5 +620,6 @@ CC=${CC_orig} AR=${AR_orig} test_search_recursion test_strip_lto +test_strip_lto_mixed test_strip_nolto texit