NetBSD Problem Report #58969
From www@netbsd.org Tue Jan 7 06:08:13 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)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5E2CC1A9238
for <gnats-bugs@gnats.NetBSD.org>; Tue, 7 Jan 2025 06:08:13 +0000 (UTC)
Message-Id: <20250107060812.4B7271A923B@mollari.NetBSD.org>
Date: Tue, 7 Jan 2025 06:08:12 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: use of alloca is warning, not error, with -std=c11
X-Send-Pr-Version: www-1.0
>Number: 58969
>Category: toolchain
>Synopsis: use of alloca is warning, not error, with -std=c11
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 07 06:10:00 +0000 2025
>Last-Modified: Mon Jan 13 15:45:02 +0000 2025
>Originator: Taylor R Campbell
>Release: current
>Organization:
The NetBSD Foundalloca
>Environment:
>Description:
While experimenting with switching the build to -std=c11 (https://mail-index.netbsd.org/tech-kern/2025/01/05/msg029919.html), I saw warnings fly by like this:
/home/riastradh/netbsd/current/obj.riscv/tooldir/bin/../lib/gcc/riscv64--netbsd/12.4.0/../../../../riscv64--netbsd/bin/ld: /home/riastradh/netbsd/current/src/../obj.riscv/destdir.riscv/lib/libc.so: warning: Warning: reference to the libc supplied alloca(3); this most likely will not work. Please use the compiler provided version of alloca(3), by supplying the appropriate compiler flags (e.g. -std=gnu99).
We can easily address these by using -std=gnu11 for the handful of files that use alloca, like execlp.c, but this has to be a build error so we don't accidentally miss the warning scrolling past in build output.
>How-To-Repeat:
1. change -std=gnu99 to -std=c11 in share/mk/bsd.sys.mk
2. build libc and anything that uses it
>Fix:
Yes, please!
>Audit-Trail:
From: matthew green <mrg@eterna23.net>
To: gnats-bugs@netbsd.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: re: toolchain/58969: use of alloca is warning, not error, with -std=c11
Date: Tue, 07 Jan 2025 18:31:04 +1100
FWIW, it's a link error on arm64.
is it not one on riscv*?
From: =?UTF-8?Q?J=C3=B6rg_Sonnenberger?= <joerg@bec.de>
To: gnats-bugs@netbsd.org, toolchain-manager@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: toolchain/58969: use of alloca is warning, not error, with
-std=c11
Date: Tue, 7 Jan 2025 11:17:21 +0100
On 1/7/25 7:10 AM, campbell+netbsd@mumble.net wrote:
> While experimenting with switching the build to -std=c11 (https://mail-index.netbsd.org/tech-kern/2025/01/05/msg029919.html), I saw warnings fly by like this:
>
> /home/riastradh/netbsd/current/obj.riscv/tooldir/bin/../lib/gcc/riscv64--netbsd/12.4.0/../../../../riscv64--netbsd/bin/ld: /home/riastradh/netbsd/current/src/../obj.riscv/destdir.riscv/lib/libc.so: warning: Warning: reference to the libc supplied alloca(3); this most likely will not work. Please use the compiler provided version of alloca(3), by supplying the appropriate compiler flags (e.g. -std=gnu99).
AFAICT there are bugs around per-symbol linker warnings in GNU ld where
the warning is shown for dynamic libraries without anything in the
current object files ever using them.
Joerg
From: Taylor R Campbell <campbell@mumble.net>
To: =?UTF-8?Q?J=C3=B6rg_Sonnenberger?= <joerg@bec.de>
Cc: gnats-bugs@netbsd.org, toolchain-manager@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/58969: use of alloca is warning, not error, with
-std=c11
Date: Tue, 7 Jan 2025 11:45:08 +0000
> Date: Tue, 7 Jan 2025 11:17:21 +0100
> From: J=F6rg Sonnenberger <joerg@bec.de>
>=20
> On 1/7/25 7:10 AM, campbell+netbsd@mumble.net wrote:
> > While experimenting with switching the build to -std=3Dc11 (https://mai=
l-index.netbsd.org/tech-kern/2025/01/05/msg029919.html), I saw warnings fly=
by like this:
> >=20
> > /home/riastradh/netbsd/current/obj.riscv/tooldir/bin/../lib/gcc/riscv64=
--netbsd/12.4.0/../../../../riscv64--netbsd/bin/ld: /home/riastradh/netbsd/=
current/src/../obj.riscv/destdir.riscv/lib/libc.so: warning: Warning: refer=
ence to the libc supplied alloca(3); this most likely will not work. Please=
use the compiler provided version of alloca(3), by supplying the appropria=
te compiler flags (e.g. -std=3Dgnu99).
>=20
> AFAICT there are bugs around per-symbol linker warnings in GNU ld where=20
> the warning is shown for dynamic libraries without anything in the=20
> current object files ever using them.
In this case, the warning is legitimate, because the files in libc
that _do_ use alloca -- execl.c, execle.c, execlp.c, and execvp.c --
need to be built with -std=3Dgnu* in order to expose the real alloca,
not -std=3Dc* which gives the broken stub reference, so compiling them
with -std=3Dc11 broke them.
We need to make this mistake a build-breaking error, not a scroll-by
warning.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/58969 CVS commit: src
Date: Mon, 13 Jan 2025 15:40:18 +0000
Module Name: src
Committed By: riastradh
Date: Mon Jan 13 15:40:18 UTC 2025
Modified Files:
src/share/mk: bsd.sys.mk
src/sys/conf: Makefile.kern.inc
Log Message:
Switch from -std=gnu99 to -std=gnu11 by default.
This is needed for newer language syntax like u"foo" for UTF-16
string literals in UEFI.
As proposed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2025/01/05/msg029919.html
Some commentators requested -std=c11 instead of -std=gnu11, but that
requires additional work -- some of it is a matter of providing asm
and typeof as aliases for __asm__ and __typeof__, but there's other
issues that need to be resolved too like PR toolchain/58969: use of
alloca is warning, not error, with -std=c11. This is a smaller
incremental change.
PR toolchain/58962: clang build broken by C11 features with -std=gnu99
To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/share/mk/bsd.sys.mk
cvs rdiff -u -r1.301 -r1.302 src/sys/conf/Makefile.kern.inc
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
(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.