From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qaIOKXkRYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:04:57 -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=DZRwjgtM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A1DCB1E166; Thu, 23 Jul 2026 09:04:57 -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 70A5D1E099 for ; Thu, 23 Jul 2026 09:04:56 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 844654BA79BE for ; Thu, 23 Jul 2026 13:04:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 844654BA79BE 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=DZRwjgtM Received: from gold.elm.relay.mailchannels.net (gold.elm.relay.mailchannels.net [23.83.212.72]) by sourceware.org (Postfix) with ESMTPS id E02224BA79A7 for ; Thu, 23 Jul 2026 13:04:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E02224BA79A7 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 E02224BA79A7 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.212.72 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811841; cv=none; b=qAx5XB5l2Gq929wbhbr2BzVNNeQVseEhIMYiWmTtbPM1LgZ5oc8qn3U8WcVzs0yyY/BFGOQ7PJRprN7YSltL9gwEdFLVl72n/4EzLLxhZm2jheTYap5GIi25D4oQSMqOptg5cWTFBoc3HNpY6zvuwYdkJakAag15VhLQ8nwiE4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811841; c=relaxed/simple; bh=JQmXh/751Ye/4srhNQ66jjgKeX1Xkn0EKDqdd+/yyoo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AvnCz+38/bWE7VXY9I4Bpo5HZLyO/JtYoYWUbLjKNfEHgjE4YL64NdLBNe1AA1yxVFhGhpdAHKxud5dnWaS9a1LB+4uO8w+QLLw0vEN1ugv5DrVlctZFvW5fNaFIib0hYTq8gNpDYVuFGvxGGxt3GOYRDkOiytpBeDR8g9kIXwc= 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=DZRwjgtM DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E02224BA79A7 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 9AC18802231 for ; Thu, 23 Jul 2026 13:03:59 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (100-104-12-45.trex-nlb.outbound.svc.cluster.local [100.104.12.45]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 4DEE68025B6 for ; Thu, 23 Jul 2026 13:03:59 +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-Ruddy-Sponge: 2576071a3daaf14e_1784811839542_1027526797 X-MC-Loop-Signature: 1784811839542:1805504075 X-MC-Ingress-Time: 1784811839541 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.104.12.45 (trex/8.0.2); Thu, 23 Jul 2026 13:03:59 +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 4h5WXZ5lmPz1041 for ; Thu, 23 Jul 2026 06:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811839; bh=HRURDxSOPm0tXiJIl3ci3FRpD3lhvnU/uvs9SgC7OK4=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=DZRwjgtM9PAiMvWzVzIl7zF1hchH3L69ZXGDBcD8lDnL/HPQ8JaYEC4JzIf8AJ1Mw RoH3+rGv7MxgvzDsiKWQC76fDwDTDQL/1bNnuluH7dc+SFSgdgkp/gVTdbIaZV790F kF5XrqJQwP0yuwYSe5kJUd036eKkR8FgjH7+V2y3R3ae4BYSDip3bEwlQOsm/FK0qm PyEtT3e+mCrU2bbitwddJGGT+pPa5JjlHaTlTQ95SSNHeQ+zGJ4reDkdLocPSev1OF gYFsg6Z1auttveYNbMFUUPAJUI9hUyW0AbMKd+o1seKOwpfiB6c0U+fclUN+sUXrce TLUw2SpWSLXdw== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 13/27] gdb/testsuite: Skip -Ttext-segment on PE Date: Thu, 23 Jul 2026 14:01:04 +0100 Message-ID: <20260723130118.206735-14-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 picks a linker flag by probing which one the linker accepts, trying -Ttext-segment (GNU ld) first, then --image-base (LLVM's lld). On a PE target that order is wrong. GNU ld accepts -Ttext-segment there, so the probe succeeds, but the PE emulation silently ignores it. OTOH, --image-base is intercepted by the PE emulation to set the real image base. I.e., even though the comment in gdb.exp says that --image-base is for LLVM lld, that is the right option for Windows GNU ld, too. The result is that on mingw and cygwin the image base was never actually being set. Fix this by skipping the -Ttext-segment probe on PE targets so the dispatch falls through to --image-base. Change-Id: I79e4f3d8ef7e94deb42b895f3bbabb402a20d269 --- gdb/testsuite/lib/gdb.exp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index dccafbb637a..fcef2022a43 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6845,11 +6845,13 @@ proc gdb_compile {source dest type options} { # procedure. Do not append it to new_options as this will cause # recursion. } elseif {[regexp "^text_segment=(.*)" $opt dummy_var addr]} { - if { [linker_supports_Ttext_segment_flag] } { - # For GNU ld. + if { ![is_pecoff_target] + && [linker_supports_Ttext_segment_flag] } { + # For GNU ld. On PE, GNU ld accepts -Ttext-segment, + # but silently ignores it. lappend new_options "ldflags=-Wl,-Ttext-segment=$addr" } elseif { [linker_supports_image_base_flag] } { - # For LLVM's lld. + # For GNU ld on PE and for LLVM's lld. lappend new_options "ldflags=-Wl,--image-base=$addr" } elseif { [linker_supports_Ttext_flag] } { # For old GNU gold versions. -- 2.54.0