From patchwork Wed Jul 8 01:55:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Lin X-Patchwork-Id: 138702 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F057B4BA2E1B for ; Wed, 8 Jul 2026 01:56:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F057B4BA2E1B X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from Atcsqr.andestech.com (atcsqr.andestech.com [220.128.198.184]) by sourceware.org (Postfix) with ESMTPS id D419F4BA23C9 for ; Wed, 8 Jul 2026 01:55:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D419F4BA23C9 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=andestech.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andestech.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D419F4BA23C9 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=220.128.198.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783475738; cv=none; b=DglDaGi85sGFPsizaRJtczo4jmSGi9Acs7gC38OYSvDF/ViM/bAlVlpPA66ZMN8KqdRNvKOsRfaqnyTCnTxF7g3/wbXHQW6dFt9IcugrNIcY1QOMBL1vwteeSMlsYCOF4m2pSa5JTpKNGl9jh/Npf9mXKSx3uLLLdXGbN/9/ZLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783475738; c=relaxed/simple; bh=UnSJS7AnqJd1cd1CZ/ZcnQviTVlzXJ28uqrNLWhX5GQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=sewVqQzfGePsEW8RMwQZn/Y0OU30kreg4/fLlm8GuGty7sqwFgcVBzTlp9QG3jPu+MUCFRHkqopbM9gcq1XbGU39c4GAOoWGRyR7NbIOjQ7EPc7fNboSfbCnL+Osdhvk0rDb0CZnOCp1UEHS+4/CNzRZsKEjX0Doe22ZqjvGZkM= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D419F4BA23C9 Received: from mail.andestech.com (ATCPCS34.andestech.com [10.0.1.134]) by Atcsqr.andestech.com with ESMTPS id 6681tUTZ019248 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Wed, 8 Jul 2026 09:55:30 +0800 (+08) (envelope-from jim@andestech.com) Received: from atccpl01.andestech.com (10.0.15.149) by ATCPCS34.andestech.com (10.0.1.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 8 Jul 2026 09:55:30 +0800 From: Jim Lin To: , , , CC: Jim Lin Subject: [PATCH] testsuite: Support check-function-bodies under slim LTO Date: Wed, 8 Jul 2026 09:55:26 +0800 Message-ID: <20260708015526.4027930-1-jim@andestech.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.0.15.149] X-ClientProxiedBy: ATCPCS33.andestech.com (10.0.1.100) To ATCPCS34.andestech.com (10.0.1.134) X-DKIM-Results: atcpcs34.andestech.com; dkim=none; X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: Atcsqr.andestech.com 6681tUTZ019248 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Under slim LTO (-flto without fat objects) a compile-only check-function-bodies test emits only LTO bytecode in its .s file and, because it never links, produces no LTRANS output, so the check finds nothing to scan. Unlike scan-assembler*, check-function-bodies had no required-options hook to force -ffat-lto-objects. Register a required-options hook for check-function-bodies so that LTO runs add -ffat-lto-objects, yielding a non-empty .s to scan. With fat objects a compile-only test no longer produces an LTRANS file, so scan the .ltrans0.ltrans.s output only when it actually exists and otherwise fall back to the .s file. gcc/testsuite/ChangeLog: * lib/scanasm.exp (check-function-bodies): Scan the LTRANS output only when it exists, otherwise fall back to the .s file. Set the required options for check-function-bodies. --- gcc/testsuite/lib/scanasm.exp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 897ce76eae5..9291735386a 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -1219,10 +1219,16 @@ proc check-function-bodies { args } { global srcdir set input_filename "$srcdir/$filename" set output_filename "[file rootname [file tail $filename]]" + # With slim LTO the regular .s holds no assembly, so a link test reads + # the post-LTO LTRANS output instead. A compile-only test produces no + # LTRANS file; check-function-bodies' required-options force + # -ffat-lto-objects for it, so fall back to the (now non-empty) .s. + set lto_filename "$output_filename.ltrans0.ltrans.s" if { [string match "* -flto *" " ${flags} "] && ![string match "* -fno-use-linker-plugin *" " ${flags} "] - && ![string match "* -ffat-lto-objects *" " ${flags} "] } { - append output_filename ".ltrans0.ltrans.s" + && ![string match "* -ffat-lto-objects *" " ${flags} "] + && [file exists $lto_filename] } { + set output_filename $lto_filename } else { append output_filename ".s" } @@ -1321,3 +1327,5 @@ proc check-function-bodies { args } { error "check-function-bodies: no matches found" } } + +set_required_options_for check-function-bodies