NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/58698: [PATCH] Define daddr_t in toolchain compat headers



>Number:         58698
>Category:       toolchain
>Synopsis:       [PATCH] Define daddr_t in toolchain compat headers
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 25 15:45:00 +0000 2024
>Originator:     gorg%gorgnet.net@localhost
>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@localhost:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
daddr_t is not defined in POSIX and is not necessarily defined on host systems.
When it is, it is not necessarily of the correct size, which may cause problems
with certain filesystems such as FFS. If daddr_t is not defined, the toolchain
build will fail.

>How-To-Repeat:
Attempt to build the toolchain on a host platform that does not define daddr_t,
such as Linux with musl libc.

>Fix:
In addition to using the compat headers to define daddr_t where it was not
previously defined, this patch also replaces a previous fix for problem report
#56742 in which daddr_t was defined on the host system as a 32 bit type instead
of as a 64 bit type, which was required:

https://mail-index.netbsd.org/source-changes/2022/03/06/msg137358.html

This patch always overrides the host's definition of daddr_t, which I thought
would be a simpler and more uniform way of addressing this problem. Please let
me know if I misinterpreted this.

Index: sys/fs/v7fs/v7fs_impl.h
===================================================================
RCS file: /cvsroot/src/sys/fs/v7fs/v7fs_impl.h,v
retrieving revision 1.1
diff -u -r1.1 v7fs_impl.h
--- sys/fs/v7fs/v7fs_impl.h	27 Jun 2011 11:52:25 -0000	1.1
+++ sys/fs/v7fs/v7fs_impl.h	25 Sep 2024 14:28:50 -0000
@@ -33,6 +33,10 @@
 #ifndef _V7FS_IMPL_H_
 #define	_V7FS_IMPL_H_
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #ifndef _KERNEL
 #include <stdbool.h>
 #include <assert.h>
Index: tools/compat/compat_defs.h
===================================================================
RCS file: /cvsroot/src/tools/compat/compat_defs.h,v
retrieving revision 1.122
diff -u -r1.122 compat_defs.h
--- tools/compat/compat_defs.h	21 Jul 2023 22:05:04 -0000	1.122
+++ tools/compat/compat_defs.h	25 Sep 2024 14:28:59 -0000
@@ -1374,4 +1374,10 @@
 u_quad_t strtouq(const char *, char **, int);
 #endif
 
+/* Force daddr_t to be 64 bits */
+#ifdef daddr_t
+#undef daddr_t
+#endif
+#define daddr_t int64_t
+
 #endif	/* !__NETBSD_COMPAT_DEFS_H__ */
Index: usr.sbin/makefs/cd9660.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/makefs/cd9660.h,v
retrieving revision 1.21
diff -u -r1.21 cd9660.h
--- usr.sbin/makefs/cd9660.h	24 Dec 2015 15:52:37 -0000	1.21
+++ usr.sbin/makefs/cd9660.h	25 Sep 2024 14:28:59 -0000
@@ -55,7 +55,6 @@
 
 #include "makefs.h"
 #include "iso.h"
-#include "iso_rrip.h"
 #include "cd9660/cd9660_eltorito.h"
 
 #ifdef DEBUG
Index: usr.sbin/makefs/ffs/buf.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/makefs/ffs/buf.h,v
retrieving revision 1.14
diff -u -r1.14 buf.h
--- usr.sbin/makefs/ffs/buf.h	6 Mar 2022 08:31:54 -0000	1.14
+++ usr.sbin/makefs/ffs/buf.h	25 Sep 2024 14:28:59 -0000
@@ -38,6 +38,10 @@
 #ifndef _FFS_BUF_H
 #define	_FFS_BUF_H
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #include <sys/param.h>
 #include <sys/queue.h>
 #include <sys/stat.h>
@@ -49,7 +53,6 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <err.h>
-#include "namespace.h"
 
 struct componentname {
 	char *cn_nameptr;
Index: usr.sbin/makefs/ffs/namespace.h
===================================================================
RCS file: usr.sbin/makefs/ffs/namespace.h
diff -N usr.sbin/makefs/ffs/namespace.h
--- usr.sbin/makefs/ffs/namespace.h	6 Mar 2022 08:31:54 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
-/*	$Id: namespace.h,v 1.1 2022/03/06 08:31:54 hgutch Exp $	*/
-
-#ifndef daddr_t
-#define daddr_t int64_t
-#endif
Index: usr.sbin/makefs/ffs/newfs_extern.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/makefs/ffs/newfs_extern.h,v
retrieving revision 1.5
diff -u -r1.5 newfs_extern.h
--- usr.sbin/makefs/ffs/newfs_extern.h	6 Mar 2022 08:31:54 -0000	1.5
+++ usr.sbin/makefs/ffs/newfs_extern.h	25 Sep 2024 14:28:59 -0000
@@ -25,7 +25,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "namespace.h"
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
 
 /* prototypes */
 struct fs	*ffs_mkfs(const char *, const fsinfo_t *, time_t);



Home | Main Index | Thread Index | Old Index