This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[VxWorks] Fix builtins tests


Several builtins/ tests fail for VxWorks RTPs because:

  (a) index, rindex, bcopy, bzero and bfill are all defined in
      the same libc.a object and

  (b) the library calls bzero, bfill and bcopy itself.

Thus if we override one of the functions in (a), we need to define
all the functions in (b), otherwise we'll get undefined symbol errors.

Tested on i586-wrs-vxworks.  OK to install?

Richard


gcc/testsuite/
	* gcc.c-torture/execute/builtins/memmove-lib.c: Include lib/bzero.c
	and lib/bfill.c on VxWorks targets.
	* gcc.c-torture/execute/builtins/memmove-2-lib.c: Likewise.
	* gcc.c-torture/execute/builtins/strchr-lib.c: Include lib/bzero.c,
	lib/bfill.c and lib/memmove.c on VxWorks targets.
	* gcc.c-torture/execute/builtins/strrchr-lib.c: Likewise.
	* gcc.c-torture/execute/builtins/memops-asm-lib.c: Include lib/bfill.c
	on VxWorks targets.
	* gcc.c-torture/execute/builtins/lib/bzero.c: New file.
	* gcc.c-torture/execute/builtins/lib/bfill.c: Likewise.

Index: gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c	(revision 122473)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/memmove-2-lib.c	(working copy)
@@ -1 +1,7 @@
 #include "lib/memmove.c"
+#ifdef __vxworks
+/* The RTP C library uses bzero and bfill, both of which are defined
+   in the same file as bcopy.  */
+#include "lib/bzero.c"
+#include "lib/bfill.c"
+#endif
Index: gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c	(revision 122473)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/strchr-lib.c	(working copy)
@@ -1 +1,8 @@
 #include "lib/strchr.c"
+#ifdef __vxworks
+/* The RTP C library uses bzero, bfill and bcopy, all of which are defined
+   in the same file as index.  */
+#include "lib/bzero.c"
+#include "lib/bfill.c"
+#include "lib/memmove.c"
+#endif
Index: gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c	(revision 122473)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c	(working copy)
@@ -77,3 +77,9 @@ bzero (void *d, size_t n)
   my_bzero (d, n);
   TEST_ABORT;
 }
+
+#ifdef __vxworks
+/* The RTP C library uses bfill, which is defined in the same file as
+   bzero and bcopy.  */
+#include "lib/bfill.c"
+#endif
Index: gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c	(revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c	(revision 0)
@@ -0,0 +1,15 @@
+extern int inside_main;
+
+void
+bzero (void *s, __SIZE_TYPE__ n)
+{
+  char *p;
+
+#ifdef __OPTIMIZE__
+  if (inside_main)
+    abort ();
+#endif
+
+  for (p = s; n-- > 0; p++)
+    *p = 0;
+}
Index: gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c	(revision 0)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c	(revision 0)
@@ -0,0 +1,15 @@
+extern int inside_main;
+
+void
+bfill (void *s, __SIZE_TYPE__ n, int ch)
+{
+  char *p;
+
+#ifdef __OPTIMIZE__
+  if (inside_main)
+    abort ();
+#endif
+
+  for (p = s; n-- > 0; p++)
+    *p = ch;
+}
Index: gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c	(revision 122473)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/memmove-lib.c	(working copy)
@@ -1 +1,7 @@
 #include "lib/memmove.c"
+#ifdef __vxworks
+/* The RTP C library uses bzero and bfill, both of which are defined
+   in the same file as bcopy.  */
+#include "lib/bzero.c"
+#include "lib/bfill.c"
+#endif
Index: gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c	(revision 122473)
+++ gcc/testsuite/gcc.c-torture/execute/builtins/strrchr-lib.c	(working copy)
@@ -1 +1,8 @@
 #include "lib/strrchr.c"
+#ifdef __vxworks
+/* The RTP C library uses bzero, bfill and bcopy, all of which are defined
+   in the same file as rindex.  */
+#include "lib/bzero.c"
+#include "lib/bfill.c"
+#include "lib/memmove.c"
+#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]