From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dIJnMdAQYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:02:08 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=NmNa5Pk/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B44E71E099; Thu, 23 Jul 2026 09:02:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B49271E099 for ; Thu, 23 Jul 2026 09:02:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A045F4BA79B5 for ; Thu, 23 Jul 2026 13:01:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A045F4BA79B5 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=NmNa5Pk/ Received: from horse.cherry.relay.mailchannels.net (horse.cherry.relay.mailchannels.net [23.83.223.84]) by sourceware.org (Postfix) with ESMTPS id B33734BA7992 for ; Thu, 23 Jul 2026 13:01:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B33734BA7992 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=palves.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B33734BA7992 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.223.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811691; cv=none; b=SQi/6dOXgCjvAN0pJOLB74GRBz/ZIvpHxQvcltdi+r0wg+LaHGTSRP5lJ3V1r30txmytng6xzl1sUHx8QAFf73My8FVjkY1bE1ZvROHIn/9gJ/nUa0g+vslSsn7gSeaU/Czn5YEXIzSHXbogidVLfqWwGHvY8sPDmIBu5o4PtVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811691; c=relaxed/simple; bh=duyv9CGwaVH1jANkUQqqg1jzlI+1GCQeMb5iWjTHqBQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Qh3eynj/l5apsl8wHqNXTydlmHx0PbJSDFl1vtWC2oZWUhKVMMUmJ0hLWakize5Gs+8xnAM89JjZYginMJjWvKFVNfaUfsSuamOA865xhosVkz7v0MUr6uq4e4wgzJhv6UExmQKTvew4gr56U0wOm9sALV5gtZ/CtPJPWHS3564= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=NmNa5Pk/ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B33734BA7992 X-Sender-Id: dreamhost|x-authsender|pedro@palves.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id AC62E3E24D8 for ; Thu, 23 Jul 2026 13:01:29 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (100-105-0-101.trex-nlb.outbound.svc.cluster.local [100.105.0.101]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 39DA73E2C5C for ; Thu, 23 Jul 2026 13:01:29 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|pedro@palves.net X-MC-Relay: Good X-MailChannels-SenderId: dreamhost|x-authsender|pedro@palves.net X-MailChannels-Auth-Id: dreamhost X-Thread-Slimy: 26b6701b502492b4_1784811689493_1206582517 X-MC-Loop-Signature: 1784811689493:444029285 X-MC-Ingress-Time: 1784811689493 Received: from pdx1-sub0-mail-a249.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.105.0.101 (trex/8.0.2); Thu, 23 Jul 2026 13:01:29 +0000 Received: from localhost (bl20-181-64.dsl.telepac.pt [2.81.181.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pedro@palves.net) by pdx1-sub0-mail-a249.dreamhost.com (Postfix) with ESMTPSA id 4h5WTh55mJzyrH for ; Thu, 23 Jul 2026 06:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811689; bh=g8n5DFXLEW07KGEEQbG/N/E7LCTOl5paMBSwuagruOg=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=NmNa5Pk/Ik4BjKD0UKtsHs+1qT/Al63n0tp/d9i0HJeIcybwbAs1j4yMQhQDBK/bf EiG34cK1d53eYG5bHvuLk2XBRlbnqBVphKnedCCFpUil+cWoQ1pouPa9asFRNRIb+E LyXqPwwMS5R9I5o6+bLtsi3vTcKOzy0b+99yFUZUD48QEa2zjIt8bPbvnN4wLrJyBm DfZdDUtaIi1LYypGoaho6FpzJX2gcM/vTuW9y6KAkz+Yg2ntKtq7wFNuGIZeMfo4ml Nx1WDfzlf60NFSGk3SVtv62YVvL12S+6eYV3DU7P2iODhHu+K4avvjpYFzl4AFNmPm Zjg89/NmxfZ/A== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 01/27] gdb/testsuite: Don't link with -lm on windows-msvc Date: Thu, 23 Jul 2026 14:00:52 +0100 Message-ID: <20260723130118.206735-2-pedro@palves.net> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260723130118.206735-1-pedro@palves.net> References: <20260723130118.206735-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org When testing with --target=x86_64-pc-windows-msvc, all C/C++ tests fail to build without this change, because target_compile adds -lm to the link line, resulting in: lld-link: error: could not open 'm.lib': no such file or directory x86_64-pc-windows-msvc targets the MSVC ABI, and uses the MSVC headers and libraries, and there is no traditional math library in that environment. The math functions are part of the C runtime library instead. DejaGnu's default_target_compile does: if {[board_info $dest exists mathlib]} { append extra_ldflags " [board_info $dest mathlib]" } else { append extra_ldflags " -lm" } Forcing people to use a custom board just to override mathlib would be too heavy handed, IMNSHO. Likewise for the approach of providing a dummy empty m.lib library. Instead, handle this by making gdb_compile itself set the mathlib board config, when targeting windows-msvc. Change-Id: Ib4671c9f207399f5ba437aaefb70373b6f298c41 --- gdb/testsuite/lib/gdb.exp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 9b86d53be08..eea39d4e8cc 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6553,6 +6553,25 @@ proc gdb_compile {source dest type options} { global objdir global gdb_saved_set_unbuffered_mode_obj + if {[istarget "*-*-windows-msvc*"]} { + # target_compile by default links with -lm, if the target + # board does not have 'mathlib' set to point to an alternative + # math library. The windows-msvc target uses the MSVC headers + # and libraries, and there is no separate math lib in that + # case, the math functions are found in the C runtime library + # instead. If mathlib is not set already in the target board, + # set it to empty and recurse, to override target_compile's + # default. + global board + set board [target_info name] + if {![board_info $board exists mathlib]} { + set_board_info mathlib "" + set result [gdb_compile $source $dest $type $options] + unset_board_info mathlib + return $result + } + } + set outdir [file dirname $dest] # Handle compiling native Windows programs when testing Cygwin. -- 2.54.0