From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 49995385842B; Fri, 23 Jun 2023 20:12:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49995385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687551141; bh=5ymnQgoUPnei419Nuc/LwGZpLlMjTJyjYck5ZH+OcjM=; h=From:To:Subject:Date:From; b=yVXHRLQjJ8QNjp8R63yhWuyZePs3OKiqjToe1Y2rayRtxoo9N9O8PyggHraRViTPB CmlTmD+h2l3ENsVAuba9mHWoUvs/TE3cTr9boLcfq/1wPdFq2tPYxKRx+KyuKhKTBB YqD4LFMoaBcC4s13tkcEfAnjQrcqds8AGvwSjmSE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] [testsuite] note pitfall in how outputs.exp sets gld X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: b7fc0a3be52f78100a270b63e7555fde078fd2e3 X-Git-Newrev: 660efbd2dec8c46bffe9430e743a39a3dcc86b9e Message-Id: <20230623201221.49995385842B@sourceware.org> Date: Fri, 23 Jun 2023 20:12:21 +0000 (GMT) List-Id: https://gcc.gnu.org/g:660efbd2dec8c46bffe9430e743a39a3dcc86b9e commit 660efbd2dec8c46bffe9430e743a39a3dcc86b9e Author: Alexandre Oliva Date: Fri Jun 23 17:09:48 2023 -0300 [testsuite] note pitfall in how outputs.exp sets gld This patch documents a glitch in gcc.misc-tests/outputs.exp: it checks whether the linker is GNU ld, and uses that to decide whether to expect collect2 to create .ld1_args files under -save-temps, but collect2 bases that decision on whether HAVE_GNU_LD is set, which may be false zero if the linker in use is GNU ld. Configuring --with-gnu-ld fixes this misalignment. Without that, atsave tests are likely to fail, because without HAVE_GNU_LD, collect2 won't use @file syntax to run the linker (so it won't create .ld1_args files). Long version: HAVE_GNU_LD is set when (i) DEFAULT_LINKER is set during configure, pointing at GNU ld; (ii) --with-gnu-ld is passed to configure; or (iii) config.gcc sets gnu_ld=yes. If a port doesn't set gnu_ld, and the toolchain isn't configured so as to assume GNU ld, configure and thus collect2 conservatively assume the linker doesn't support @file arguments. But outputs.exp can't see how configure set HAVE_GNU_LD (it may be used to test an installed compiler), and upon finding that the linker used by the compiler is GNU ld, it will expect collect2 to use @file arguments when running the linker. If that assumption doesn't hold, atsave tests will fail. for gcc/testsuite/ChangeLog * outputs.exp (gld): Note a known mismatch and record a workaround. Diff: --- gcc/testsuite/gcc.misc-tests/outputs.exp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index 7ee355034cc..9f44cbdb0b5 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -50,7 +50,15 @@ if !$skip_lto { set ltop [check_linker_plugin_available] } -# Check for GNU LD. Some files like .ld1_args depend on this. +# Check for GNU LD. Some files like .ld1_args depend on this. This +# should really be testing whether HAVE_GNU_LD was set by configure. +# If we find GNU ld here, but the compiler wasn't configured +# --with-gnu-ld or with DEFAULT_LINKER pointing at GNU ld, on a target +# that doesn't set gnu_ld=yes unconditionally, configure and thus +# collect2 will conservatively assume there's no support for @file in +# the linker, but our atfile tests will expect ld1_args files to be +# created, and thus fail. Configuring the compiler --with-gnu-ld +# fixes this. set gld [check_effective_target_gld] # Prepare additional options to be used for linking.