Subject: m68k and sun2 vs. __BSWAP_RENAME
To: None <port-m68k@NetBSD.org>
From: Havard Eidnes <he@NetBSD.org>
List: port-m68k
Date: 09/15/2007 18:21:48
----Next_Part(Sat_Sep_15_18_21_48_2007_798)--
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,

recent build failures in sys/rump/fs/bin/cd9660fs/ reveals that sun2
and the other m68k ports are internally inconsistent with respect to
whether their libc.so libraries define __bswap{16,32} or bswap{16,32}
and whether their include files do the renaming or not.

m68k/include/bswap.h define __BSWAP_RENAME before <sys/bswap.h> is
included, while sun2 does not.  Thus, these ports have different
expectations wrt. what should go in libc.so.

However, these ports share the assembly files which implement these
functions, and they compile into defining just bswap16 and bswap32,
irrespectively of any defines.

The attached patch fixes this build failure for both the m68k ports
and the sun2 port, doing the __BSWAP_RENAME into the __bswap{16,32}
functions for all these ports.

Any objections to checking it in?  (This is patterned after i386,
which has corresponding #ifs in its assembly files.)

Regards,

- H=E5vard

----Next_Part(Sat_Sep_15_18_21_48_2007_798)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Index: common/lib/libc/arch/m68k/gen/bswap16.S
===================================================================
RCS file: /u/nb/src/common/lib/libc/arch/m68k/gen/bswap16.S,v
retrieving revision 1.1
diff -u -r1.1 bswap16.S
--- common/lib/libc/arch/m68k/gen/bswap16.S	20 Dec 2005 19:28:49 -0000	1.1
+++ common/lib/libc/arch/m68k/gen/bswap16.S	15 Sep 2007 16:13:03 -0000
@@ -28,7 +28,11 @@
 
 #include <machine/asm.h>
 
-ENTRY(bswap16)
+#if defined(_KERNEL) || defined(_STANDALONE)
+_ENTRY(_C_LABEL(bswap16))
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
+_ENTRY(_C_LABEL(__bswap16))
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
 	movl	%sp@(4),%d0
 	rolw	#8,%d0
 	rts
Index: common/lib/libc/arch/m68k/gen/bswap32.S
===================================================================
RCS file: /u/nb/src/common/lib/libc/arch/m68k/gen/bswap32.S,v
retrieving revision 1.1
diff -u -r1.1 bswap32.S
--- common/lib/libc/arch/m68k/gen/bswap32.S	20 Dec 2005 19:28:49 -0000	1.1
+++ common/lib/libc/arch/m68k/gen/bswap32.S	15 Sep 2007 16:13:03 -0000
@@ -28,7 +28,11 @@
 
 #include <machine/asm.h>
 
-ENTRY(bswap32)
+#if defined(_KERNEL) || defined(_STANDALONE)
+_ENTRY(_C_LABEL(bswap32))
+#else /* defined(_KERNEL) || defined(_STANDALONE) */
+_ENTRY(_C_LABEL(__bswap32))
+#endif /* defined(_KERNEL) || defined(_STANDALONE) */
 	movl	%sp@(4),%d0
 	rolw	#8,%d0
 	swap	%d0
Index: sys/arch/sun2/include/bswap.h
===================================================================
RCS file: /u/nb/src/sys/arch/sun2/include/bswap.h,v
retrieving revision 1.1
diff -u -r1.1 bswap.h
--- sys/arch/sun2/include/bswap.h	6 Apr 2001 13:13:02 -0000	1.1
+++ sys/arch/sun2/include/bswap.h	15 Sep 2007 16:13:04 -0000
@@ -3,6 +3,7 @@
 #ifndef _MACHINE_BSWAP_H_
 #define	_MACHINE_BSWAP_H_
 
+#define __BSWAP_RENAME
 #include <sys/bswap.h>
 
 #endif /* !_MACHINE_BSWAP_H_ */

----Next_Part(Sat_Sep_15_18_21_48_2007_798)----