| Message ID | ae-BMT4p0QeM4CKL@mx3210.local |
|---|---|
| State | New |
| Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 21FAC4BAD17E for <patchwork@sourceware.org>; Mon, 27 Apr 2026 15:31:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21FAC4BAD17E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=bell.net header.i=@bell.net header.a=rsa-sha256 header.s=selector1 header.b=o7h+Zcia X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from cmx-mtlrgo002.bell.net (mta-mtl-001.bell.net [209.71.208.11]) by sourceware.org (Postfix) with ESMTP id DA2324B9DB7E for <binutils@sourceware.org>; Mon, 27 Apr 2026 15:30:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA2324B9DB7E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=bell.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bell.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DA2324B9DB7E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.71.208.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777303860; cv=none; b=NEi706ydTTnJZivBVcHwRs1hG/Ogj3dH/J4b40LkbEgJknb7Nf6bb4O74RZjdgFqmAZ6n+os0YObVokn8butLkcHHYiAJxspEbo7KFG4pjML8vlD3HlC74zFXyBtCdQBSfOznVR3cJ2WUZyivSbxSlB7UoKhgXxlhCxJ8SdHXRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777303860; c=relaxed/simple; bh=yupuseYqqVy0H+Mhsntqb4zc+7cXsvRz9kAaIX6pVGc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=beTOfdD4kRToTt7t3baUN2JhQAvaFSLXnRr/lLoyHxy7wXCOlhXFGd1R1tlvreNpQ5ToXqF8A54vkogM60Yl2DYGm1IIDp7GsoY2SeB48KdqCl4tiQkxV+UhzGv4VPEGLc6PDE2JPAiEhv6l3RIrDySDIW6jnP3su0t+tEmy4YA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA2324B9DB7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell.net; s=selector1; t=1777303859; bh=zq8mx8VOBmWP56A2MI6rKvYpd5se/mz7m62upftMNfs=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; b=o7h+ZciabRcRQlJ65/lSUl0jrlerqOTz6y0dQ6xqRusAzlaPSH3EQFskc6ver1ZnmAZHnHcpV55S3jiXKJ7dZO2inTqhfpkuEUy/4Imm9FwDldQXMwnKDKULDcG1vYCc07Ui6/R8DZMXucGGMzhPh3ZfR0UVl8LlelvbdQhs3JGrB331VXoBG0Hq+iVUJVrJUjO2sUVEv5Jd2/ObBkZzZtSbH+fUHOd71Q7MPsAAJvOZJIXfacX9aadeHeNos9hHHc+Hb8DSnoKpjDTghDVrP+fmd1TESr2QKRTDxcT8oen0e3ffdL396cHTvGB6ijjimrMzNNlOpAHDwsabLzxF6A== X-RG-SOPHOS: Clean X-RG-VADE-SC: 0 X-RG-VADE: Clean X-Originating-IP: [142.112.252.193] X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 69B7AEA703D4B350 X-RazorGate-Vade: dmFkZTEnvN7GhrFI2m0tkmtjpaX/W7iDG6aWU1opV+jxPOEDjhoTl2ANwFnUJ/7+C0gO6VhOug/iXq0OtLWfO8KCocXGrPoqoreN41RWKq/MuHNfCWEHS93C+EPqMQlr6C+tOOl5wbyIlksHtWXx3Lxc8Ndq1Al0EEte9mYthKPlqCG2DTlg3ZAG9dQqLCd6/pdgo0fg/OcLFDmC/UofOfcvUiwcQeNKjfJ0saJd3pjU/um9RDK7WXJU5fG9NmbCw1lH/SpNDYEp/eUcBwXezYnUrIp0iBODKFSleHCWyMcehJYRDGfbVZvm01KFRSW+/sJKrfkxg3AMaDO9ZRtaGNcriC4yf7y8jq6uy2SaYxekM+O2ctU/RLuSE0aYgw+/P8UUWbqA/QuKLNa4VZjPS+3e2xLuSfO5HzCHDuvQ9l1k6yUXsgXiIylRZMHS7cK9G2MO9WXurdXkBsT3O0hG0uMhRAQihjnHM3F6/DLfYFh0ZCKNEdbfxjcGOaHDmTSorSGSais/HBDX2VjYEONiKlOYRJqKXa7WC8PVJc25irN5gkPn6aMSvgyT5wK0DcEaNKpUHlfwrOL0T3Jh0b/ybfiKhYGxJoQbeIhhUd3DZzoC8WP5qu9gtLklp9R9MyR7oG1yC5lQpGz200JAycUwAlZVXX3M/w7koZ/7jzWiGdqOem7FsQ X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from mx3210.local (142.112.252.193) by cmx-mtlrgo002.bell.net (authenticated as dave.anglin@bell.net) id 69B7AEA703D4B350; Mon, 27 Apr 2026 11:30:58 -0400 Date: Mon, 27 Apr 2026 11:30:57 -0400 From: John David Anglin <dave.anglin@bell.net> To: Binutils <binutils@sourceware.org> Cc: Alan Modra <amodra@gmail.com>, "Maciej W. Rozycki" <macro@orcam.me.uk> Subject: [PATCH] ld: Append LDFLAGS to flags variable in default_ld_link Message-ID: <ae-BMT4p0QeM4CKL@mx3210.local> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VXnAMpQ7Lxr/HyLk" Content-Disposition: inline X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
ld: Append LDFLAGS to flags variable in default_ld_link
|
|
Commit Message
John David Anglin
April 27, 2026, 3:30 p.m. UTC
ld: Append LDFLAGS to flags variable in default_ld_link The following change is needed to fix errors trying to load the milli.a archive for the hppa*64*-*-hpux* target when the host system isn't hpux. We need to create a dummy milli.a archive for this target and append the directory of this archive to LDFLAGS. This assumes the testsuite takes the LDFLAGS environment variable into account. However, some tests in the ld testsuite use the low-level `ld-link' procedure and it fails to take LDFLAGS into account. This change modifies the `default_ld_link' procedure to append $LDFLAGS to the flags variable and fix the above issue. This change potentially affects the `alpha*-*-*vms*' target but currently no tests run for it make direct use of `ld-link'. Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk> 2026-04-27 John David Anglin <danglin@gcc.gnu.org> ld/ChangeLog: * testsuite/lib/ld-lib.exp (default_ld_link): Append LDFLAGS to `flags' variable. Also use the append command to append the board flags.
Comments
On Mon, 27 Apr 2026, John David Anglin wrote: > ld: Append LDFLAGS to flags variable in default_ld_link > > The following change is needed to fix errors trying to load the > milli.a archive for the hppa*64*-*-hpux* target when the host > system isn't hpux. > > We need to create a dummy milli.a archive for this target and > append the directory of this archive to LDFLAGS. > > This assumes the testsuite takes the LDFLAGS environment variable > into account. However, some tests in the ld testsuite use the > low-level `ld-link' procedure and it fails to take LDFLAGS into > account. > > This change modifies the `default_ld_link' procedure to append > $LDFLAGS to the flags variable and fix the above issue. > > This change potentially affects the `alpha*-*-*vms*' target but > currently no tests run for it make direct use of `ld-link'. Technically this is a fix to the testsuite/lib/ld-lib.exp part of commit 740341b9be65 ("Provide dummy libraries for alpha-vms"), so as I previously suggested can you please combine your update with the removal of $LDFLAGS propagation from `run_ld_link_tests' (and now that I've double-checked said commit, also other places such as `section_check') and mention it in the description that this is so that $LDFLAGS is taken into account with all linker invocations rather than the chosen ones only? Or do you have reasons you'd rather not to? Alan: do you agree that this approach makes more sense? We have numerous `ld_link' invocations across the test framework, a few of which only get LDFLAGS passed and all would otherwise have to be updated and any new ones arranged accordingly. While one can argue this is an incompatible change, because `default_ld_link' can be overridden and therefore people's setups out there will have to be updated accordingly, it seems to me in line with its sibling handlers such as `default_ld_assemble' or `default_ld_compile' which use analogous variables such as $ASFLAGS or $CFLAGS_FOR_TARGET, so that will be consistent with what we already have anyway. NB `ld_link' rather than `ld-link' please. Maciej
On Mon, Apr 27, 2026 at 11:30:57AM -0400, John David Anglin wrote: > ld/ChangeLog: > > * testsuite/lib/ld-lib.exp (default_ld_link): Append > LDFLAGS to `flags' variable. Also use the append command > to append the board flags. OK, thanks.
On 2026-04-28 10:18 p.m., Alan Modra wrote: > On Mon, Apr 27, 2026 at 11:30:57AM -0400, John David Anglin wrote: >> ld/ChangeLog: >> >> * testsuite/lib/ld-lib.exp (default_ld_link): Append >> LDFLAGS to `flags' variable. Also use the append command >> to append the board flags. > > OK, thanks. After Maciej's last comments, I had updated the change to remove references to LDFLAGS from `run_ld_link_tests'. But after inspecting the following commit https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=740341b9be657772538f9cf0b563c49798f47b3c it seemed that LDFLAGS was intentionally not added to the flags variable in default_ld_link. In that change, checks.exp and a number of other .exp files were updated to pass LDFLAGS to ld. Maybe it would be safer to update the .exp files that don't currently pass LDFLAGS to ld as that seems to be the current practice? Dave
On Wed, Apr 29, 2026 at 11:57:36AM -0400, John David Anglin wrote: > On 2026-04-28 10:18 p.m., Alan Modra wrote: > > On Mon, Apr 27, 2026 at 11:30:57AM -0400, John David Anglin wrote: > >> ld/ChangeLog: > >> > >> * testsuite/lib/ld-lib.exp (default_ld_link): Append > >> LDFLAGS to `flags' variable. Also use the append command > >> to append the board flags. > > > > OK, thanks. > > After Maciej's last comments, I had updated the change to remove references > to LDFLAGS from `run_ld_link_tests'. But after inspecting the following commit > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=740341b9be657772538f9cf0b563c49798f47b3c > it seemed that LDFLAGS was intentionally not added to the flags variable in default_ld_link. > In that change, checks.exp and a number of other .exp files were updated to pass LDFLAGS > to ld. Maybe it would be safer to update the .exp files that don't currently pass > LDFLAGS to ld as that seems to be the current practice? That was likely why I did it that way, but if you need all occurrences of ld_link to use LDFLAGS then I'm happy for you to put it in default_ld_link, and ideally remove the then unnecessary places I added LDFLAGS. > > Dave > -- > John David Anglin dave.anglin@bell.net
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index d37d33cd96c..5da81424cb5 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -231,11 +231,13 @@ proc get_board_flags {} { proc default_ld_link { ld target objects } { global host_triplet global exec_output + global LDFLAGS set flags "" if [is_endian_output_format $objects] then { set flags [big_or_little_endian] } + append flags " $LDFLAGS" # When using GCC as the linker driver, we need to specify board cflags when # linking because cflags may contain linker options. For example when @@ -245,7 +247,7 @@ proc default_ld_link { ld target objects } { if {[string match "*cc*" $gccexe] || [string match "*++*" $gccexe] || [string match "clang*" $gccexe]} then { - set flags "$flags [get_board_flags]" + append flags " [get_board_flags]" } remote_file host delete $target