From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sWqRFxURYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:03:17 -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=NJ5F8uzb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5DFA31E099; Thu, 23 Jul 2026 09:03:17 -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 A4DA81E099 for ; Thu, 23 Jul 2026 09:03:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CD0A4BA79AE for ; Thu, 23 Jul 2026 13:03:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CD0A4BA79AE 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=NJ5F8uzb Received: from cichlid.elm.relay.mailchannels.net (cichlid.elm.relay.mailchannels.net [23.83.212.36]) by sourceware.org (Postfix) with ESMTPS id 365374BA79A8 for ; Thu, 23 Jul 2026 13:02:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 365374BA79A8 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 365374BA79A8 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.212.36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811771; cv=none; b=NFqF3fP2JT3Fx/EpDRqWiHVWYO49IQLV/mqM5qDHEsFApBWBDRuI9SfIerHlCoIkvMCWMERyJqskKcrdenkfUuF+icU+8N79p2hHj0HLKwHa8K8pKbEurJA06pSYv4ntUZPThzo5QdFTtyrjimhFHT/wp1pPAsDTyob8KBSeOo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811771; c=relaxed/simple; bh=gSVG3Ge6He+kWRMDm2MI/ZjtmI4644liKIhu6zWn7RY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qcMusS+BV9KvEWURz9ZHBm/tpAcmoEoK+8i7hFCZwkVHdTA7MCnwd2ChGGQs8jJdDX8Jr/U4fJj7UyZ5WYeMl20IE4elMy46sdWNGIk8mLLch9jXY6UVphqRflA+IbBkecQMUu2dSfxkfAW1lEOFNMecZoboZAnq+Sl7b0EAXtA= 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=NJ5F8uzb DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 365374BA79A8 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 E151C6145D for ; Thu, 23 Jul 2026 13:02:49 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (100-103-95-6.trex-nlb.outbound.svc.cluster.local [100.103.95.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E7FF262F0C for ; Thu, 23 Jul 2026 13:02:45 +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-Minister-Keen: 045dea1900aa1acf_1784811769820_4103954716 X-MC-Loop-Signature: 1784811769820:3363838529 X-MC-Ingress-Time: 1784811769820 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.95.6 (trex/8.0.2); Thu, 23 Jul 2026 13:02:49 +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 4h5WW92mfhz1041 for ; Thu, 23 Jul 2026 06:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811765; bh=hxYXBrtlNKpZzC7FFDXsieEr9Mw3bsGY9mKvKaIQx8g=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=NJ5F8uzb+1YATRCuNuAWeNL+cvtUwuvqtz3wK8qTePDnnu6qJ6c73+Ss4zYDmZlXj KRT0/lcIBKU58m3GqvSLPXMkvJhadteXuQ1te9i9FjTwxqIzxbYN18+/MIgUEVh4YF lEo6W2Ezdkwe97G340BoJojgfDCbaYbxj+Qeci+X88tVeV6zEjpznwoQYxGe9RtR9O iEatM2a935lZlWrtUIZSRyV4y7SLwLwzf95L/frTrdyZDrdfgjbvphSN+6XwqZWQqD wnHdIrGU0kKWwUrOObYzFOyYmgilLNTvHyqEjg3PH7SpwlKt4HHNyadU4KHgsoBPo9 qEf3avD9WCgJQ== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 06/27] gdb/testsuite: Don't pass -fPIC on PE/COFF targets Date: Thu, 23 Jul 2026 14:00:57 +0100 Message-ID: <20260723130118.206735-7-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 '-fPIC' is not needed for any PE/COFF-based target. We were passing '-fPIC' on mingw and cygwin, and it works there because GCC and Clang simply ignore that option for those targets (to ease portability), but Clang for x86_64-pc-windows-msvc isn't as forgiving: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc' Originally, gdb.exp wasn't passing -fPIC on cygwin/mingw, but it started doing that with commit 2f4132646d8 ("[gdb/testsuite] Don't pass -fPIC to gdb_compile_shlib"). Before that commit, gdb_compile_shlib added -fpic on the platforms that need it, but added nothing in some cases (cygwin, mingw and pe, and the unknown-compiler fallback), and the individual testcases papered over that by passing additional_flags=-fPIC unconditionally themselves. That commit moved the -fPIC from the testcase calls to gdb_compile_shlib, adding it in exactly those previously-empty cases, which is how cygwin and mingw ended up being passed -fPIC even though they don't need it. Change-Id: I6883bc14381883eac3ee825a65ef67ed26bcadce --- gdb/testsuite/lib/gdb.exp | 47 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index db22d2bc320..25f01ed9727 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -7226,35 +7226,32 @@ proc gdb_compile_shlib_1 {sources dest options} { set info_options "c" } - switch -glob [test_compiler_info "" ${info_options}] { - "xlc-*" { - lappend obj_options "additional_flags=-qpic" - } - "clang-*" { - if { [istarget "*-*-cygwin*"] - || [istarget "*-*-mingw*"] } { - lappend obj_options "additional_flags=-fPIC" - } else { - lappend obj_options "additional_flags=-fpic" + if { [is_pecoff_target] } { + # Nothing needed, PE targets always compile all code as + # position-independent. + } else { + switch -glob [test_compiler_info "" ${info_options}] { + "xlc-*" { + lappend obj_options "additional_flags=-qpic" } - } - "gcc-*" { - if { [istarget "powerpc*-*-aix*"] - || [istarget "rs6000*-*-aix*"] - || [istarget "*-*-cygwin*"] - || [istarget "*-*-mingw*"] - || [istarget "*-*-pe*"] } { - lappend obj_options "additional_flags=-fPIC" - } else { + "clang-*" { lappend obj_options "additional_flags=-fpic" } - } - "icc-*" { + "gcc-*" { + if { [istarget "powerpc*-*-aix*"] + || [istarget "rs6000*-*-aix*"] } { + lappend obj_options "additional_flags=-fPIC" + } else { + lappend obj_options "additional_flags=-fpic" + } + } + "icc-*" { lappend obj_options "additional_flags=-fpic" - } - default { - # don't know what the compiler is... - lappend obj_options "additional_flags=-fPIC" + } + default { + # don't know what the compiler is... + lappend obj_options "additional_flags=-fPIC" + } } } -- 2.54.0