From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uWDzJe0RYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:06:53 -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=bGdUY0Pz; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 90FC41E09E; Thu, 23 Jul 2026 09:06:53 -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 [38.145.34.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 1EDBB1E099 for ; Thu, 23 Jul 2026 09:06:53 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 366744BA23F7 for ; Thu, 23 Jul 2026 13:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 366744BA23F7 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=bGdUY0Pz Received: from cockroach.yew.relay.mailchannels.net (cockroach.yew.relay.mailchannels.net [23.83.220.37]) by sourceware.org (Postfix) with ESMTPS id 740C24BA7984 for ; Thu, 23 Jul 2026 13:04:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 740C24BA7984 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 740C24BA7984 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.220.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811853; cv=none; b=oU5pmezI4fBr/lwiFV1QxPWdDm+KKwkQ42NriYgAO8v13hYWPBZ4vS0TvOSvsHGjBmiK7lIsagMkPudklOcGwsqWUDz/MOVj+VN8EZ6NvFT8IjE9N7rygviBQWAtidwbp/zPP4MrcsbV8VuvtVNAgoYW1r8iKOnJECsYZ2NIQyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811853; c=relaxed/simple; bh=ejMHYQcCiFLQB31l8PR0ufq+Rh4dTDnHN9/GgUhszjU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aZYZnZaF8DYjdEocZ8IHzSaVXQOQqm/tPTFCIJBPjpnRB2LYD4Jm/3nWf5P+vPyA/Iio5ZJ0NeHmApVRo92DeEMMuF/FkV+iY3rbhUMEpRwYszT98fSp/h6HHJl/PaPbx//8y9ifPpVPyCVbmeIVASHWGqOfSvUKd8+1AV43tk8= 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=bGdUY0Pz DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 740C24BA7984 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 1D9257E3DD9 for ; Thu, 23 Jul 2026 13:04:12 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (100-103-105-133.trex-nlb.outbound.svc.cluster.local [100.103.105.133]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B47F37E3D97 for ; Thu, 23 Jul 2026 13:04:11 +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-Vacuous-Cure: 393fbe460acd77fd_1784811851968_3348463750 X-MC-Loop-Signature: 1784811851968:2258344062 X-MC-Ingress-Time: 1784811851968 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.103.105.133 (trex/8.0.2); Thu, 23 Jul 2026 13:04:11 +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 4h5WXq1LL8z1041 for ; Thu, 23 Jul 2026 06:04:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811851; bh=CEPttQBzTPQhgAfvqlsiV13T9eC7qio2q8xHaNmP0a8=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=bGdUY0PzECeZSUsVafj3Xjwc9Fwp55fJGSelRyCgiQHMj+MSV5giQYelcWnPAGYTq E49zelesaLXnavnsXdRQ7wnWTzkfmm9AR8L6ol4gGZjEovaHPZXkuLn6z+IXVY2J68 wbnap8D2ITssVIiDS7dzMTIE6GonL3lwA+/NIoVZk0e8/zV5/IdQsn/OZAiahifAA1 VtVrFrQ90gld3Nx6GRj8fyDhzHEG+fCAFH7X93isB6ubBmdBhk2SFTABWHhPBa43wE yN+SzAdN26WScGEQUkU8eugRFn71REuUrcx04OuXtPy9Ugvh3jDI7nqtodMZrKH79n 4pgtdCovTVBjg== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 14/27] gdb/testsuite: Support text_segment on windows-msvc via /BASE Date: Thu, 23 Jul 2026 14:01:05 +0100 Message-ID: <20260723130118.206735-15-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 The gdb_compile text_segment option asks the linker to place the image at a specific base address. It dispatches to the right linker flag by probing which one the linker accepts: -Ttext-segment => GNU ld --image-base => LLVM's lld -Ttext => gold None of those are accepted by lld-link, the linker clang drives on a windows-msvc target, so gdb_compile errors out with "Don't know how to handle text_segment option." Add a fourth probe case using lld-link's /BASE switch, gated on a new linker_supports_base_flag probe that mirrors the existing ones. /BASE sets the preferred image base the same way GNU ld's --image-base does. Change-Id: I84d5a3de6d755a3794abb7358b16de5e516ddefa --- gdb/testsuite/lib/gdb.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index fcef2022a43..bece5b6044d 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6853,6 +6853,9 @@ proc gdb_compile {source dest type options} { } elseif { [linker_supports_image_base_flag] } { # For GNU ld on PE and for LLVM's lld. lappend new_options "ldflags=-Wl,--image-base=$addr" + } elseif { [linker_supports_base_flag] } { + # For lld-link (MSVC link.exe compatible mode). + lappend new_options "ldflags=-Wl,/BASE:$addr" } elseif { [linker_supports_Ttext_flag] } { # For old GNU gold versions. lappend new_options "ldflags=-Wl,-Ttext=$addr" @@ -11457,6 +11460,15 @@ gdb_caching_proc linker_supports_image_base_flag {} { return [gdb_simple_compile $me $src executable $flags] } +# Return 1 if linker supports /BASE (lld-link / MSVC link.exe), +# otherwise 0. +gdb_caching_proc linker_supports_base_flag {} { + set me "linker_supports_base_flag" + set flags ldflags=[quote_for_host -Wl,/BASE:0x7000000] + set src { int main() { return 0; } } + return [gdb_simple_compile $me $src executable $flags] +} + # Return 1 if the linker is lld-link which can embed our application # manifest by itself, otherwise 0. Probes the exact flag combination # gdb_compile uses. -- 2.54.0