From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OTi/NFQRYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:04:20 -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=WwmH35IC; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D2E1C1E099; Thu, 23 Jul 2026 09:04:20 -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 436001E099 for ; Thu, 23 Jul 2026 09:04:20 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB6DE4BA798B for ; Thu, 23 Jul 2026 13:04:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB6DE4BA798B 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=WwmH35IC Received: from glass.elm.relay.mailchannels.net (glass.elm.relay.mailchannels.net [23.83.212.70]) by sourceware.org (Postfix) with ESMTPS id 2C9154BA9004 for ; Thu, 23 Jul 2026 13:03:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C9154BA9004 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 2C9154BA9004 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.212.70 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811789; cv=none; b=Ye7cGtMRNZxIzFE3ZvCpU2TTxlPksgXdeczBJ+Uao6ojGUGjHIIxvpRup9Ryp7WEAKDZHLGo/SF2+L6Oph/Z09951LYY52eB6ZzbCaVAEbd1yXI89MaQ/s/UphPEddrIkWmhhPR5HCRYGmJwh6y5iyRHPtRxUZHfZZy//xdr8w4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811789; c=relaxed/simple; bh=TgxIzFhBO8maJ+/Nh1EBUKzmt/NwNdTawXN2UXke/uQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=b64pfQHoFIjcK85YvNA7XOWZ3VLld9/FKcuAeKWBZMBeET9x1AIAB58Dq+AZsRTZyJ/UuINx8FcC9IckoEC9CpI+zStiQ7Pe3Te0nnvY5qhcJozdz4jjWvxnzkAjU+qLmE6k4R9eC+fb98nF6vyQXMExFd8tkSq/mRtyFMINuc0= 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=WwmH35IC DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C9154BA9004 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 1477C4C222D for ; Thu, 23 Jul 2026 13:03:08 +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 B8BD24C2A9F for ; Thu, 23 Jul 2026 13:03:07 +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-Industry-Continue: 06f854dd003b23a9_1784811787997_1810802107 X-MC-Loop-Signature: 1784811787997:747221726 X-MC-Ingress-Time: 1784811787997 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:03:07 +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 4h5WWb1lP9z106X for ; Thu, 23 Jul 2026 06:03:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811787; bh=WsWUJz1eDfAaRMTM0WinPxlJDtL0Mp/8XlpkLZU2qZA=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=WwmH35ICN/Dx4LBTJMhNbOR480HJMQu89Egk2enkM9XKQ3vPz5YVFJmEo9uxbsWhV NVS0ddg9Eai1ESa3wDXTX+1Yf1FCxH+0m1C4bV36+jJN7YkfvXvqRTppM3+Y5BQRDp xb2lhJrCoFFWSXsH4BhGcajtketroVFDn11nguFn/NySSJw2NG4dk+qCfCSUCrMY// NzC25jDQGOUCxoIOd4wqdl8fGp6S4HfzNeaC1Uow6Oh2aEsyFfloAACdv1NXTOEZgO G9hibJ7cU9QAF95a3jWie1SvHXdJ7vaXdIDCTR8dbUrTFJnybTLho3LqpD0p6Xm4Tj rMMZLp9zGvfSQ== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 09/27] gdb/testsuite: Restrict --no-as-needed to ELF targets Date: Thu, 23 Jul 2026 14:01:00 +0100 Message-ID: <20260723130118.206735-10-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 gdb_compile passes -Wl,--no-as-needed when linking a test executable against a shared library, to keep the shared library's DT_NEEDED entry even when no symbol from it is referenced at link time. --as-needed/--no-as-needed is an ELF concept, though: it controls whether the linker emits a DT_NEEDED tag in the .dynamic section for a shared library that ends up unreferenced. Other object formats have no DT_NEEDED, so the flag does nothing there. E.g., PE records a DLL dependency in the import table, driven by which symbols are actually imported. GNU ld accepts the option and silently ignores it for a PE target (to easy portability), but lld-link, the linker clang drives on windows-msvc, warns about it: lld-link: warning: ignoring unknown argument '--no-as-needed' Fix this by restricting the flag to ELF targets, using the existing is_elf_target predicate. Change-Id: Icb472ba2e9e38c25c179e14648340acaea2f463d --- gdb/testsuite/lib/gdb.exp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b3588f0edec..dccafbb637a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6819,7 +6819,18 @@ proc gdb_compile {source dest type options} { if { [is_pecoff_target] && ![istarget "*-*-windows-msvc*"] } { lappend new_options "ldflags=-Wl,--enable-auto-import" } - if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } { + # --as-needed/--no-as-needed control whether the + # linker emits a DT_NEEDED entry for an unreferenced + # shared library, which is an ELF .dynamic-section + # concept. It does nothing on other object formats + # (PE records DLL dependencies via the import table, + # Mach-O via LC_LOAD_DYLIB load commands, XCOFF via + # the loader section), and lld-link doesn't even + # recognize the option, warning about it. So only + # pass it when producing ELF. + if { [is_elf_target] + && ([test_compiler_info "gcc-*"] + || [test_compiler_info "clang-*"]) } { # Undo debian's change in the default. # Put it at the front to not override any user-provided # value, and to make sure it appears in front of all the -- 2.54.0