NetBSD Problem Report #58696

From sender@gorgnet.net  Wed Sep 25 15:12:03 2024
Return-Path: <sender@gorgnet.net>
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 175431A923B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Sep 2024 15:12:03 +0000 (UTC)
Message-Id: <20240925151147.2740.qmail@gorgnet.net>
Date: 25 Sep 2024 15:11:47 -0000
From: gorg@gorgnet.net
Reply-To: gorg@gorgnet.net
To: gnats-bugs@NetBSD.org
Subject: [PATCH] ssize_t undefined in build of toolchain gcc
X-Send-Pr-Version: 3.95

>Number:         58696
>Category:       toolchain
>Synopsis:       [PATCH] ssize_t undefined in build of toolchain gcc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 15:15:01 +0000 2024
>Closed-Date:    Sun Oct 13 20:23:51 +0000 2024
>Last-Modified:  Sun Oct 13 20:23:51 +0000 2024
>Originator:     gorg@gorgnet.net
>Release:        NetBSD current
>Organization:
>Environment:
System: NetBSD 10.0 NetBSD 10.0 (GENERIC64) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
POSIX specifies that ssize_t must be defined in sys/types.h:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html

NetBSD includes sys/types.h in sys/param.h. However, when building the
toolchain on systems which do not define ssize_t in sys/param.h directly or
indirectly, regsub.cc in gcc fails to compile because it uses ssize_t while
only including sys/param.h:

regsub.cc:101:8: error: 'ssize_t' does not name a type; did you mean 'size_t'?
  101 | static ssize_t
      |        ^~~~~~~
      |        size_t

>How-To-Repeat:
Attempt to build the toolchain on a system in which ssize_t is not usable
through including sys/param.h, such as Linux with musl libc.

>Fix:
Index: external/gpl3/gcc/dist/gcc/regsub.cc
===================================================================
RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/regsub.cc,v
retrieving revision 1.1
diff -u -r1.1 regsub.cc
--- external/gpl3/gcc/dist/gcc/regsub.cc	1 Aug 2023 06:04:42 -0000	1.1
+++ external/gpl3/gcc/dist/gcc/regsub.cc	25 Sep 2024 14:25:23 -0000
@@ -32,6 +32,7 @@
 extern "C" {

 #include <sys/param.h>
+#include <sys/types.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 08 Oct 2024 22:04:17 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-10, maybe pullup-9

Commit cited wrong PR:

https://mail-index.netbsd.org/source-changes/2024/09/25/msg153543.html

Module Name:    src
Committed By:   christos
Date:           Wed Sep 25 16:26:05 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/gcc: regsub.cc

Log Message:
PR/58686: gorg: Add <sys/types.h> for ssize_t.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/regsub.cc


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 13 Oct 2024 00:04:49 +0000
State-Changed-Why:
pullup-10 #960 https://releng.netbsd.org/cgi-bin/req-10.cgi?show=960
pullup-9 #1903 https://releng.netbsd.org/cgi-bin/req-9.cgi?show=1903


State-Changed-From-To: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 13 Oct 2024 20:23:51 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 9 and 10

Wrong PR number cited in commit message, here's the commits to 9 and 10:

https://mail-index.netbsd.org/source-changes/2024/10/13/msg153874.html
https://mail-index.netbsd.org/source-changes/2024/10/13/msg153873.html



Module Name:    src
Committed By:   martin
Date:           Sun Oct 13 14:21:42 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/gcc [netbsd-9]: regsub.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1903):

        external/gpl3/gcc/dist/gcc/regsub.cc: revision 1.2
        (applied to ..../regsub.c)

PR/58686: gorg: Add <sys/types.h> for ssize_t.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.18.1 src/external/gpl3/gcc/dist/gcc/regsub.c


Module Name:    src
Committed By:   martin
Date:           Sun Oct 13 14:20:18 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/gcc [netbsd-10]: regsub.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #960):

        external/gpl3/gcc/dist/gcc/regsub.cc: revision 1.2
        (applied to ..../regsub.c)

PR/58686: gorg: Add <sys/types.h> for ssize_t.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.26.1 src/external/gpl3/gcc/dist/gcc/regsub.c


>Unformatted:

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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.