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)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8D8781581CF for ; Fri, 13 Jun 2025 08:32:12 +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 798CB3415DE for ; Fri, 13 Jun 2025 08:32:12 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id D15CE1104DC; Fri, 13 Jun 2025 08:32:08 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 C7F681104DC for ; Fri, 13 Jun 2025 08:32:08 +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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7ED003423F8 for ; Fri, 13 Jun 2025 08:32:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E46CB2900 for ; Fri, 13 Jun 2025 08:32:06 +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: <1749803521.c4695b465b2736b418c784146cc21ec6f4dcc31e.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: c4695b465b2736b418c784146cc21ec6f4dcc31e X-VCS-Branch: master Date: Fri, 13 Jun 2025 08:32:06 +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: cc4e4720-0dc5-4476-a6c5-3c622de5b5c4 X-Archives-Hash: 5567ffabbf0b66cda172c4d8554944fd commit: c4695b465b2736b418c784146cc21ec6f4dcc31e Author: Sam James gentoo org> AuthorDate: Fri Jun 13 08:28:17 2025 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jun 13 08:32:01 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4695b46 eclass/tests: add more strip tests to dot-a for non-LTO bug Add tests that would've found the issue w/ non-LTO static libraries not being stripped. Bug: https://bugs.gentoo.org/957882 Bug: https://sourceware.org/PR33078 Signed-off-by: Sam James gentoo.org> eclass/tests/dot-a.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/eclass/tests/dot-a.sh b/eclass/tests/dot-a.sh index 6a01ce5798b8..30f1ae1292bf 100755 --- a/eclass/tests/dot-a.sh +++ b/eclass/tests/dot-a.sh @@ -414,6 +414,56 @@ test_search_recursion() { tend ${ret} "Unexpected LTO object found" } +test_strip_nolto() { + # Check whether regular (non-LTO'd) static libraries are stripped + # and not ignored (bug #957882, https://sourceware.org/PR33078). + tbegin "whether strip ignores non-LTO static archives" + ret=0 + ( + rm foo.a foo.a.bak 2>/dev/null + _create_test_progs + + $(tc-getCC) a.c -o a.o -c -ggdb3 || return 1 + $(tc-getAR) q foo.a a.o 2>/dev/null || return 1 + cp foo.a foo.a.bak || return 1 + $(tc-getSTRIP) -d foo.a || return 1 + + # They should differ after stripping. + cmp -s foo.a foo.a.bak && return 1 + # The stripped version should be smaller. + orig_size=$(stat -c %s foo.a.bak) + stripped_size=$(stat -c %s foo.a) + (( ${stripped_size} < ${orig_size} )) || return 1 + + return 0 + ) || ret=1 + tend ${ret} "strip ignored an archive when it shouldn't" + + # Check whether regular (non-LTO'd) static libraries are stripped + # and not ignored (bug #957882, https://sourceware.org/PR33078). + tbegin "whether strip -d ignores non-LTO static archives" + ret=0 + ( + rm foo.a foo.a.bak 2>/dev/null + _create_test_progs + + $(tc-getCC) a.c -o a.o -c -ggdb3 || return 1 + $(tc-getAR) q foo.a a.o 2>/dev/null || return 1 + cp foo.a foo.a.bak || return 1 + $(tc-getSTRIP) -d foo.a || return 1 + + # They should differ after stripping. + cmp -s foo.a foo.a.bak && return 1 + # The stripped version should be smaller. + orig_size=$(stat -c %s foo.a.bak) + stripped_size=$(stat -c %s foo.a) + (( ${stripped_size} < ${orig_size} )) || return 1 + + return 0 + ) || ret=1 + tend ${ret} "strip -d ignored an archive when it shouldn't" +} + _repeat_tests_with_compilers() { # Call test_lto_guarantee_fat and test_strip_lto_bytecode with # various compilers and linkers. @@ -463,4 +513,5 @@ _create_test_progs _repeat_tests_with_compilers _repeat_mixed_tests_with_linkers test_search_recursion +test_strip_nolto texit