Subject: GCC: Outstanding patches
To: None <port-vax@NetBSD.org>
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
List: port-vax
Date: 07/08/2007 00:44:48
--bZ2MuwyI/0uB8yuJ
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi!

I'm currently digging throug the Linux patches for gcc. One of this
touches NetBSD and OpenBSD code and I'd like to get your comments on
it.

*BSD seem have _udiv and _urem in libc. For Linux, I'd prefer to have
it in libgcc.  Could anybody of you please give it a run? (Just ignore
the failing chunks for lib1funcs.S and linux.h)


diff -Nurp src-gcc-fresh/gcc/config/vax/lib1funcs.S src-gcc-hacked/gcc/conf=
ig/vax/lib1funcs.S
--- src-gcc-fresh/gcc/config/vax/lib1funcs.S	1970-01-01 01:00:00.000000000 =
+0100
+++ src-gcc-hacked/gcc/config/vax/lib1funcs.S	2005-12-09 22:19:00.000000000=
 +0100
@@ -0,0 +1,85 @@
[...]
+	.align	4
+	.global	__udivsi3
+	.type	__udivsi3, @function
+__udivsi3:
[...]
+	.align	4
+	.global	__umodsi3
+	.type	__umodsi3, @function
+__umodsi3:
[...]
diff -Nurp src-gcc-fresh/gcc/config/vax/linux.h src-gcc-hacked/gcc/config/v=
ax/linux.h
--- src-gcc-fresh/gcc/config/vax/linux.h	2005-12-09 22:18:14.000000000 +0100
+++ src-gcc-hacked/gcc/config/vax/linux.h	2005-12-09 22:19:00.000000000 +01=
00
@@ -28,4 +28,8 @@
  * the ELF binary format.
  */
=20
+#ifdef HAVE___UDIV___UREM_IN_LIBC
+#undef HAVE___UDIV___UREM_IN_LIBC
+#endif
+
 #endif /* _CONFIG_VAX_LINUX_H */
diff -Nurp src-gcc-fresh/gcc/config/vax/netbsd.h src-gcc-hacked/gcc/config/=
vax/netbsd.h
--- src-gcc-fresh/gcc/config/vax/netbsd.h	2005-10-28 18:32:14.000000000 +02=
00
+++ src-gcc-hacked/gcc/config/vax/netbsd.h	2005-12-09 22:19:00.000000000 +0=
100
@@ -46,3 +46,7 @@ Boston, MA 02110-1301, USA.  */
 /* We use gas, not the UNIX assembler.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT 0
+
+/* BSDs do have __udev and __urem in libc.  */
+#define HAVE___UDIV___UREM_IN_LIBC
+
diff -Nurp src-gcc-fresh/gcc/config/vax/openbsd1.h src-gcc-hacked/gcc/confi=
g/vax/openbsd1.h
--- src-gcc-fresh/gcc/config/vax/openbsd1.h	2005-10-28 18:32:14.000000000 +=
0200
+++ src-gcc-hacked/gcc/config/vax/openbsd1.h	2005-12-09 22:19:00.000000000 =
+0100
@@ -19,5 +19,9 @@ the Free Software Foundation, 51 Frankli
 Boston, MA 02110-1301, USA.  */
=20
 /* Set up definitions before picking up the common openbsd.h file.  */
-#define OBSD_OLD_GAS=20
+#define OBSD_OLD_GAS
 #define OBSD_NO_DYNAMIC_LIBRARIES
+
+/* BSDs do have __udiv and __urem in libc.  */
+#define HAVE___UDIV___UREM_IN_LIBC
+
diff -Nurp src-gcc-fresh/gcc/config/vax/openbsd.h src-gcc-hacked/gcc/config=
/vax/openbsd.h
--- src-gcc-fresh/gcc/config/vax/openbsd.h	2005-10-28 18:32:14.000000000 +0=
200
+++ src-gcc-hacked/gcc/config/vax/openbsd.h	2005-12-09 22:19:00.000000000 +=
0100
@@ -44,3 +44,7 @@ Boston, MA 02110-1301, USA.  */
=20
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 32
+
+/* BSDs do have __udiv and __urem in libc.  */
+#define HAVE___UDIV___UREM_IN_LIBC
+
diff -Nurp src-gcc-fresh/gcc/config/vax/t-vax src-gcc-hacked/gcc/config/vax=
/t-vax
--- src-gcc-fresh/gcc/config/vax/t-vax	1970-01-01 01:00:00.000000000 +0100
+++ src-gcc-hacked/gcc/config/vax/t-vax	2005-12-09 22:19:00.000000000 +0100
@@ -0,0 +1,4 @@
+# LIB1ASMSRC =3D vax/lib1funcs.S
+# LIB1ASMFUNCS =3D _udivsi3 _uremsi3
+# LIB1ASMSRC =3D $(srcdir)/config/udivmod.c $(srcdir)/config/udivmodsi4.c
+LIB2FUNCS_EXTRA =3D $(srcdir)/config/udivmod.c $(srcdir)/config/udivmodsi4=
=2Ec
diff -Nurp src-gcc-fresh/gcc/config/vax/vax.c src-gcc-hacked/gcc/config/vax=
/vax.c
--- src-gcc-fresh/gcc/config/vax/vax.c	2005-10-28 18:32:14.000000000 +0200
+++ src-gcc-hacked/gcc/config/vax/vax.c	2005-12-09 22:19:00.000000000 +0100
@@ -46,13 +46,15 @@ Boston, MA 02110-1301, USA.  */
=20
 static void vax_output_function_prologue (FILE *, HOST_WIDE_INT);
 static void vax_file_start (void);
-static void vax_init_libfuncs (void);
 static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
 				 HOST_WIDE_INT, tree);
 static int vax_address_cost_1 (rtx);
 static int vax_address_cost (rtx);
 static bool vax_rtx_costs (rtx, int, int, int *);
 static rtx vax_struct_value_rtx (tree, int);
+#ifdef HAVE___UDIV___UREM_IN_LIBC
+static void vax_init_libfuncs (void);
+#endif
 =0C
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -66,8 +68,10 @@ static rtx vax_struct_value_rtx (tree, i
 #undef TARGET_ASM_FILE_START_APP_OFF
 #define TARGET_ASM_FILE_START_APP_OFF true
=20
+#ifdef HAVE___UDIV___UREM_IN_LIBC
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS vax_init_libfuncs
+#endif
=20
 #undef TARGET_ASM_OUTPUT_MI_THUNK
 #define TARGET_ASM_OUTPUT_MI_THUNK vax_output_mi_thunk
@@ -155,6 +166,7 @@ vax_file_start (void)
     fprintf (asm_out_file, "___vax_%c_doubles:\n", ASM_DOUBLE_CHAR);
 }
=20
+#ifdef HAVE___UDIV___UREM_IN_LIBC
 /* We can use the BSD C library routines for the libgcc calls that are
    still generated, since that's what they boil down to anyways.  When
    ELF, avoid the user's namespace.  */
@@ -165,6 +177,7 @@ vax_init_libfuncs (void)
   set_optab_libfunc (udiv_optab, SImode, TARGET_ELF ? "*__udiv" : "*udiv");
   set_optab_libfunc (umod_optab, SImode, TARGET_ELF ? "*__urem" : "*urem");
 }
+#endif /* HAVE___UDIV___UREM_IN_LIBC */
=20
 /* This is like nonimmediate_operand with a restriction on the type of MEM=
=2E  */
=20


Thanks, JBG

--=20
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:  The course of history shows that as a government grows, libe=
rty
the second  : decreases."  (Thomas Jefferson)

--bZ2MuwyI/0uB8yuJ
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGkBdgHb1edYOZ4bsRAlD7AJ95PfJq12ErUYqpOGFTkgr/H6h0wwCcCIAw
Y+ZgyfSAhRSPFznEDeT1IFs=
=Oew/
-----END PGP SIGNATURE-----

--bZ2MuwyI/0uB8yuJ--