From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id odcSL80RYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:06:21 -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=E7dW4Kuk; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B93711E099; Thu, 23 Jul 2026 09:06:21 -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 3BEFB1E099 for ; Thu, 23 Jul 2026 09:06:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50B574BA2E22 for ; Thu, 23 Jul 2026 13:06:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50B574BA2E22 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=E7dW4Kuk Received: from common.larch.relay.mailchannels.net (common.larch.relay.mailchannels.net [23.83.213.38]) by sourceware.org (Postfix) with ESMTPS id D428E4BA7998 for ; Thu, 23 Jul 2026 13:04:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D428E4BA7998 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 D428E4BA7998 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.213.38 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811862; cv=none; b=Ol+BfULtBWfl1CAKEsspRh+DHVMjGtMvfO2624wxcAxWdj1D2siRMWAUzfOMGwJwv0P7YfLdqlnSM9pV7Y2VLEoZNRBKznstMV7sgAlL8Eot3II35AHjX1DNXp6KxlzEpXZ7HQguLXFPe6t6hT3ZR0/zybnOamtgDd+Jxb3zGdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811862; c=relaxed/simple; bh=8h4rEFZ4SDCrjMQjY5GIiHp1+6XQ9NpfAJ5qRd1jUR0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OzEzEW5Nk8tgFqYtLXrV6YA1dlJ6Vdgrx+ruW1TjMs+MlgwJYSyYDVMUsADVpMEqvAmXrAm29MM78hrN0vh2UQVKPmGJtvx+YBEhkJd6Wa6A266mNHvhYcOvLlXTYnuMtCFIKndqKNStannL4enxTsJuP7vMKFFNZ9DYvoHnmOc= 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=E7dW4Kuk DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D428E4BA7998 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 93F49402A0D for ; Thu, 23 Jul 2026 13:04:20 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (trex-green-7.trex.outbound.svc.cluster.local [100.103.100.118]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 341C640279E for ; Thu, 23 Jul 2026 13:04:20 +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-Dime-Name: 314bb69272e67836_1784811860439_3499858265 X-MC-Loop-Signature: 1784811860439:2600761180 X-MC-Ingress-Time: 1784811860439 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.100.118 (trex/8.0.2); Thu, 23 Jul 2026 13:04:20 +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 4h5WXz32y2zyrH for ; Thu, 23 Jul 2026 06:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811859; bh=RDWr1iqOvqDwe1DC8ip9r8F8niFRXOMmv+bYO3br0oU=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=E7dW4Kuk0WmkcOX7ZkvZrV5ZatXu+k7G8g4x+zZzW8w05V7nXLz7a2xKpyUyum34F TGbyy24LbwAyuJiTAW0CxwEhEGGMnTF9Px7q7UZ/j49n/rv2Wa2kMtr4h14wKiZnK3 h2T/c15SMq9emWtMkAx7/WgiDVXqwY4bPN1y1igneZV3GZupt2WyN1TXgmW71tU6xm RYEdkqzF7UvN6vOL1Z+E7+LcEdwi6CokULyb6kt3Y4kbYLLhmy8CutLKzLjT3f0+Fe f3RpyzEHqNNH0mNGpwympaVqgnFziiCmo2TxSpcqTp0vI3ComzBsKExRIKX2V2clLu d8qEVNRO7Y8og== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 15/27] gdb.base/shreloc.exp: Use gdb_compile text_segment to set image base Date: Thu, 23 Jul 2026 14:01:06 +0100 Message-ID: <20260723130118.206735-16-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.base/shreloc.exp testcase wants its two shared libraries to have the same preferred image base, so that when GDB mishandles a relocated library its symbols collapse onto the other's and the check_different tests catch it. On cygwin/mingw, to guarantee this, it passes -Wl,--image-base directly. Express the intent through gdb_compile's text_segment option instead of open-coding the linker flag, and gate it on is_pecoff_target so it is done on all PE targets, including windows-msvc. This is mainly to avoid istarget special-casing, as in practice lld-link already gives every DLL the same fixed default base, there is no equivalent of --enable-auto-image-base there. The second, cygwin/mingw-only block that checks the "_minor_os_version__" absolute symbol is left as is. That symbol is specific to GNU ld's PE output, so the check does not apply to windows-msvc. That will change in a follow patch, though. Change-Id: I002ed69603804c1ef6f18c0aa7b563e6bd80941b --- gdb/testsuite/gdb.base/shreloc.exp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp index e0efd61bcdf..718b1ca81ad 100644 --- a/gdb/testsuite/gdb.base/shreloc.exp +++ b/gdb/testsuite/gdb.base/shreloc.exp @@ -38,8 +38,15 @@ set lib2_sl [standard_output_file shreloc2.sl] set lib_opts {debug shlib} set exec_opts [list debug shlib=$lib1_sl shlib=$lib2_sl] -if {([istarget "*pc-cygwin"] || [istarget "*pc-mingw32"]) } { - lappend lib_opts "ldflags=-Wl,--image-base,0x04000000" +if { [is_pecoff_target] } { + # Force both shared libraries to the same image base so that they + # overlap and one of them gets relocated at load time, which is + # what this test exercises. Without this, they would not + # necessarily overlap: some MinGW ld distributions default to + # --enable-auto-image-base, which derives each DLL's base from a + # hash of its file name, giving the two libraries different bases. + # Pinning the base defeats that. + lappend lib_opts "text_segment=0x04000000" } if {[test_compiler_info "xlc-*"]} { -- 2.54.0