Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Aug 2019 15:47:48 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351078 - in head: lib/libc/quad stand/libsa
Message-ID:  <201908151547.x7FFlmtn078965@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Aug 15 15:47:48 2019
New Revision: 351078
URL: https://svnweb.freebsd.org/changeset/base/351078

Log:
  stand: kick out quad.h
  
  Use quad.h from libc instead for the time being. This reduces the number of
  nearly-identical-quad.h we have in tree to two with only minor changes.
  
  Prototypes for some *sh*di3 have been added to match the copy in libkern.
  The differences between the two are likely few enough that they can perhaps
  be merged with little additional effort to bring us down to 1.
  
  MFC after:	3 days

Deleted:
  head/stand/libsa/quad.h
Modified:
  head/lib/libc/quad/quad.h
  head/stand/libsa/Makefile

Modified: head/lib/libc/quad/quad.h
==============================================================================
--- head/lib/libc/quad/quad.h	Thu Aug 15 15:27:58 2019	(r351077)
+++ head/lib/libc/quad/quad.h	Thu Aug 15 15:47:48 2019	(r351078)
@@ -55,6 +55,11 @@
 #include <sys/types.h>
 #include <limits.h>
 
+#ifdef _STANDALONE
+_Static_assert(sizeof(quad_t) == sizeof(int) * 2,
+	"Bitwise function in libstand are broken on this architecture\n");
+#endif
+
 /*
  * Depending on the desired operation, we view a `long long' (aka quad_t) in
  * one or more of the following formats.
@@ -79,7 +84,14 @@ union uu {
  */
 #define	QUAD_BITS	(sizeof(quad_t) * CHAR_BIT)
 #define	LONG_BITS	(sizeof(long) * CHAR_BIT)
+#ifdef _STANDALONE
+/*
+ * libsa assumes sizeof(int) for qdivrem
+ */
+#define	HALF_BITS	(sizeof(int) * CHAR_BIT / 2)
+#else
 #define	HALF_BITS	(sizeof(long) * CHAR_BIT / 2)
+#endif
 
 /*
  * Extract high and low shortwords from longword, and move low shortword of
@@ -103,3 +115,7 @@ u_quad_t	__udivdi3(u_quad_t a, u_quad_t b);
 u_quad_t	__umoddi3(u_quad_t a, u_quad_t b);
 
 typedef unsigned int	qshift_t;
+
+quad_t		__ashldi3(quad_t, qshift_t);
+quad_t		__ashrdi3(quad_t, qshift_t);
+quad_t		__lshrdi3(quad_t, qshift_t);

Modified: head/stand/libsa/Makefile
==============================================================================
--- head/stand/libsa/Makefile	Thu Aug 15 15:27:58 2019	(r351077)
+++ head/stand/libsa/Makefile	Thu Aug 15 15:47:48 2019	(r351078)
@@ -121,6 +121,7 @@ beforedepend:
 	ln -sf ${SYSDIR}/sys/stdint.h stdint.h; \
 	ln -sf ${SRCTOP}/include/arpa/inet.h arpa/inet.h; \
 	ln -sf ${SRCTOP}/include/arpa/tftp.h arpa/tftp.h; \
+	ln -sf ${LIBC_SRC}/quad/quad.h quad.h; \
 	for i in _time.h _strings.h _string.h; do \
 		[ -f xlocale/$$i ] || cp /dev/null xlocale/$$i; \
 	done; \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908151547.x7FFlmtn078965>