NetBSD Problem Report #58984

From www@netbsd.org  Sun Jan 12 03:08:26 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6B8AC1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 12 Jan 2025 03:08:26 +0000 (UTC)
Message-Id: <20250112030825.0488C1A923B@mollari.NetBSD.org>
Date: Sun, 12 Jan 2025 03:08:24 +0000 (UTC)
From: uwe@stderr.spb.ru
Reply-To: uwe@stderr.spb.ru
To: gnats-bugs@NetBSD.org
Subject: gcc configure doesn't quote some variables properly
X-Send-Pr-Version: www-1.0

>Number:         58984
>Category:       toolchain
>Synopsis:       gcc configure doesn't quote some variables properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 12 03:10:00 +0000 2025
>Originator:     Valery Ushakov
>Release:        NetBSD current
>Organization:
>Environment:
>Description:
src/external/gpl3/gcc/dist/gcc/configure doesn't quote the value of
gcc_cv_ld properly so when that value contains spaces, configure
probably misdetects a bunch of ld-related features.  configure has a
bunch of

  if test x$gcc_cv_ld != x; then

all in all:

  $ grep 'x\$gcc_cv_ld\b' src/external/gpl3/gcc/dist/gcc/configure | wc -l
  36

so

  checking linker -Bstatic/-Bdynamic option... /home/uwe/work/netbsd/ro/src/external/gpl3/gcc/dist/gcc/configure: 25916: test: x/home/uwe/work/netbsd/build/tools/bin/sparc64--netbsd-ld: unexpected operator
  no

etc, etc...
>How-To-Repeat:
Discovered when testing the following:

$ cd compat/sparc64/sparc
$ nbmake-sparc64 BOOTSTRAP_SUBDIRS=../../../lib clean
$ nbmake-sparc64 BOOTSTRAP_SUBDIRS=../../../lib depends

observe in the output:

--- depend-libgcov ---
#    create  libgcov/auto-build.h
... gcc_cv_ld=/home/uwe/work/netbsd/build/tools/bin/sparc64--netbsd-ld\ -m\ elf32_sparc\ -m\ elf32_sparc\ -m\ elf32_sparc ... /usr/bin/sh /home/uwe/work/netbsd/ro/src/external/gpl3/gcc/dist/gcc/configure ...

...
checking how to hardcode library paths into programs... immediate
basename: extra operand 'elf32_sparc'
Try 'basename --help' for more information.
checking whether we are using gold... /home/uwe/work/netbsd/ro/src/external/gpl3/gcc/dist/gcc/configure: 23262: test: x/home/uwe/work/netbsd/build/tools/bin/sparc64--netbsd-ld: unexpected operator
no
...

etc

>Fix:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.