This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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]

Re: Gcc builtin functions used by glibc not available on mips


On Wed, Feb 06, 2002 at 11:27:24PM -0800, Ulrich Drepper wrote:
> Eric Christopher <echristo@redhat.com> writes:
> 
> > Someone could have some weird hacked up version that didn't have the
> > facility that you would otherwise think was there.
> 
> We support no weird hacked-up versions.  And by not supporting
> otherwise standard features there will always be problems and any work
> on this architecture will take much longer than for any other.  Plus,
> the interest in even caring about the architecture will drop.  Mine
> wrt to MIPS already dropped to zero.
> 

Here is a patch to make glibc to compile on mips. The more I work on
mips, the more I agree with that the MIPS ABI is fundamentally broken
as far as glibc is concerned :-(. I wish we could have a new, sane mips
ABI for glibc. I know I am dreaming :-).


H.J.
---
2002-02-06  H.J. Lu  <hjl@gnu.org>

	* config.h.in (HAVE_BUILTIN_MEMSET): New.

	* configure.in: Check if __builtin_memset really works.
	* configure: Rebuild.

	* elf/rtld.c (_dl_start): Check HAVE_BUILTIN_MEMSET instead of
	__GNUC_PREREQ (2, 96) before using __builtin_memset.

--- libc/config.h.in.builtin	Mon Feb  4 13:44:56 2002
+++ libc/config.h.in	Wed Feb  6 23:16:04 2002
@@ -85,6 +85,9 @@
 /* Define if the compiler supports __builtin_expect.  */
 #undef	HAVE_BUILTIN_EXPECT
 
+/* Define if the compiler supports __builtin_memset.  */
+#undef	HAVE_BUILTIN_MEMSET
+
 /* Define if the regparm attribute shall be used for local functions
    (gcc on ix86 only).  */
 #undef	USE_REGPARMS
--- libc/configure.in.builtin	Wed Feb  6 12:12:50 2002
+++ libc/configure.in	Wed Feb  6 23:17:58 2002
@@ -1404,6 +1404,25 @@ if test "$libc_cv_gcc_builtin_expect" = 
   AC_DEFINE(HAVE_BUILTIN_EXPECT)
 fi
 
+AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
+cat > conftest.c <<\EOF
+void zero (void *x)
+{
+  __builtin_memset (x, 0, 4);
+}
+EOF
+dnl
+if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
+then
+  libc_cv_gcc_builtin_memset=no
+else
+  libc_cv_gcc_builtin_memset=yes
+fi
+rm -f conftest* ])
+if test "$libc_cv_gcc_builtin_memset" = yes ; then
+  AC_DEFINE(HAVE_BUILTIN_MEMSET)
+fi
+
 dnl Check whether the compiler supports subtraction of local labels.
 AC_CACHE_CHECK(for local label subtraction, libc_cv_gcc_subtract_local_labels,
 [cat > conftest.c <<EOF
--- libc/elf/rtld.c.builtin	Wed Feb  6 12:12:50 2002
+++ libc/elf/rtld.c	Wed Feb  6 23:28:10 2002
@@ -132,7 +132,7 @@ _dl_start (void *arg)
 {
   struct link_map bootstrap_map;
   hp_timing_t start_time;
-#if !__GNUC_PREREQ (2, 96)
+#ifndef HAVE_BUILTIN_MEMSET
   size_t cnt;
 #endif
 
@@ -152,7 +152,7 @@ _dl_start (void *arg)
      `memset' since it might not be built in or inlined and we cannot
      make function calls at this point.  Use '__builtin_memset' if we
      know it is available.  */
-#if __GNUC_PREREQ (2, 96)
+#ifdef HAVE_BUILTIN_MEMSET
   __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
 #else
   for (cnt = 0;


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