From patchwork Wed Oct 2 13:48:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1992019 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4XJbkB2JDgz1xt3 for ; Wed, 2 Oct 2024 23:48:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35E153865451 for ; Wed, 2 Oct 2024 13:48:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 8BB2C38650DC for ; Wed, 2 Oct 2024 13:48:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8BB2C38650DC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8BB2C38650DC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727876890; cv=none; b=fTUdBHA6ylmAnC0jayrn88RxvFc0iUztERdUJPIEYZs1pRMdoxdwL8l/7RN2LgBSlflZWFNSi6ODoG2M/m5xhknIpmI0kEqySAGxLm0MlDSqhEjlvTDNDHxunwd0ISSVF8joIG9L2COF7Z6XW3fbvRQt2S0LEOuaU8ONwYW8Cu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727876890; c=relaxed/simple; bh=kONdmO1raNYbdrhorv/4/CFUlH9OZWwMuI2XNA91L0Y=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=lFqiinzoIuQ7BH1VunJ6EX1bKrTk83tUKu3zh2PVzxPAa9L364CBPNSxTduQ3JUwILcED1rW80byeBML76XBVfV+yFuMq3LlTpyj8zK+1RFG/O+7/C/8v/yZdfFeELOxEz03Oz1PkPq5VM+SPeUau+BcSoLN1K5bcWTIW2hnKT4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D9C12339 for ; Wed, 2 Oct 2024 06:48:38 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 09B943F64C for ; Wed, 2 Oct 2024 06:48:08 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [PATCH] testsuite: Make check-function-bodies work with LTO Date: Wed, 02 Oct 2024 14:48:07 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Spam-Status: No, score=-18.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.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~incoming=patchwork.ozlabs.org@gcc.gnu.org This patch tries to make check-function-bodies automatically choose between reading the regular assembly file and reading the LTO assembly file. There should only ever be one right answer, since check-function-bodies doesn't make sense on slim LTO output. Maybe this will turn out to be impossible to get right, but I'd like to try at least. Tested on aarch64-linux-gnu. OK to install? Richard gcc/testsuite/ * lib/scanasm.exp (check-function-bodies): Look in ltrans0.ltrans.s if the test appears to be using LTO. --- gcc/testsuite/lib/scanasm.exp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp index 737eefc655e..26504deb0e6 100644 --- a/gcc/testsuite/lib/scanasm.exp +++ b/gcc/testsuite/lib/scanasm.exp @@ -997,16 +997,17 @@ proc check-function-bodies { args } { error "too many arguments to check-function-bodies" } + upvar 2 dg-extra-tool-flags extra_tool_flags + set flags $extra_tool_flags + + global torture_current_flags + if { [info exists torture_current_flags] } { + append flags " " $torture_current_flags + } + if { [llength $args] >= 3 } { set required_flags [lindex $args 2] - upvar 2 dg-extra-tool-flags extra_tool_flags - set flags $extra_tool_flags - - global torture_current_flags - if { [info exists torture_current_flags] } { - append flags " " $torture_current_flags - } foreach required_flag $required_flags { switch -- $required_flag { target - @@ -1043,7 +1044,14 @@ proc check-function-bodies { args } { global srcdir set input_filename "$srcdir/$filename" - set output_filename "[file rootname [file tail $filename]].s" + set output_filename "[file rootname [file tail $filename]]" + if { [string match "* -flto *" " ${flags} "] + && ![string match "* -fno-use-linker-plugin *" " ${flags} "] + && ![string match "* -ffat-lto-objects *" " ${flags} "] } { + append output_filename ".ltrans0.ltrans.s" + } else { + append output_filename ".s" + } set prefix [lindex $args 0] set prefix_len [string length $prefix]