From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id CD8963858400 for ; Sat, 27 Nov 2021 08:18:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CD8963858400 Received: by smtp.gentoo.org (Postfix, from userid 559) id 387A5342F63; Sat, 27 Nov 2021 08:18:56 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: testsuite: add dedicated flag for init toolchain tests Date: Sat, 27 Nov 2021 03:18:53 -0500 Message-Id: <20211127081853.26792-1-vapier@gentoo.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Nov 2021 08:18:58 -0000 As we setup more reliable CC_FOR_TARGET variables for each target, the bfin way of overriding it to stuff custom CFLAGS doesn't scale well. Add a dedicated CFLAGS_FOR_TARGET_init setting that each set of tests can setup if they want to add custom options. --- sim/testsuite/bfin/allinsn.exp | 4 ++-- sim/testsuite/lib/sim-defs.exp | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sim/testsuite/bfin/allinsn.exp b/sim/testsuite/bfin/allinsn.exp index a9dc08457b26..2be369dc9383 100644 --- a/sim/testsuite/bfin/allinsn.exp +++ b/sim/testsuite/bfin/allinsn.exp @@ -2,9 +2,9 @@ # Set a default CPU to satisfy bfin-elf-gcc requirements. BF537 should work # with all standard Blackfin toolchains. -set CC_FOR_TARGET "[find_gcc] -mcpu=bf537" +global CFLAGS_FOR_TARGET_init +set CFLAGS_FOR_TARGET_init "-mcpu=bf537" sim_init -unset CC_FOR_TARGET if [istarget bfin-*-elf] { # all machines diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index fca66af26a86..cd16bbb13b96 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -55,6 +55,7 @@ proc sim_init_toolchain {} { global global_cpp_works global global_cc_works global global_cc_os + global CFLAGS_FOR_TARGET_init # Reset all the toolchain settings. This provides a clean slate when # starting the next set of tests. @@ -64,24 +65,30 @@ proc sim_init_toolchain {} { set SIMFLAGS_FOR_TARGET "" unset -nocomplain cpu_option cpu_option_sep + # Merge per-test settings if available. + if ![info exists CFLAGS_FOR_TARGET_init] { + set CFLAGS_FOR_TARGET_init "" + } + set cc_options [list "additional_flags=$CFLAGS_FOR_TARGET_init"] + # See if we have a preprocessor available. set result [target_compile $srcdir/lib/compilercheck.c \ - $objdir/compilercheck.x "preprocess" ""] + $objdir/compilercheck.x "preprocess" $cc_options] set global_cpp_works [string equal "" "$result"] # See if we have a compiler available, and which environment it's targeting. if { [target_compile $srcdir/lib/newlibcheck.c \ - $objdir/compilercheck.x "executable" ""] == "" } { + $objdir/compilercheck.x "executable" $cc_options] == "" } { verbose -log "Found newlib C compiler" set global_cc_works 1 set global_cc_os "newlib" } elseif { [target_compile $srcdir/lib/linuxcheck.c \ - $objdir/compilercheck.x "executable" ""] == "" } { + $objdir/compilercheck.x "executable" $cc_options] == "" } { verbose -log "Found Linux C compiler" set global_cc_works 1 set global_cc_os "linux" } elseif { [target_compile $srcdir/lib/compilercheck.c \ - $objdir/compilercheck.x "executable" ""] == "" } { + $objdir/compilercheck.x "executable" $cc_options] == "" } { verbose -log "Found C compiler, but unknown OS" set global_cc_works 1 set global_cc_os "" @@ -91,6 +98,8 @@ proc sim_init_toolchain {} { } file delete $objdir/compilercheck.x + + unset CFLAGS_FOR_TARGET_init } # Print the version of the simulator being tested. -- 2.33.0