linux-mips build fix

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Fri Sep 13 10:19:00 GMT 2002


On Thursday 12 September 2002 20:40, Franz Sirl wrote:
> On Thursday 12 September 2002 20:26, Jakub Jelinek wrote:
> > On Thu, Sep 12, 2002 at 08:21:57PM +0200, Franz Sirl wrote:
> > > Hmm, I haven't checked yet, but if the Makefile in sysdeps/wordsize-32/
> > > is used, is it still assured that it prefers and uses
> > > sysdeps/powerpc/powerpc32/divdi3.c on ppc32?
> >
> > Sure, those Makefile hunks just add divdi3 into sysdep_routines.
> > Where is divdi3 located is a vpath question which is unrelated.
>
> Ah, yes, sorry, I was confused :-).
>
> > > BTW, can't we INTDEF and hide all 4 divdi3 routines?
> >
> > INTDEF doesn't hide __divdi3, it adds a __divdi3_internal alias (the
> > more recent version of this is libc_hidden_proto() and libc_hidden_def())
> > which is hidden, so it is something else than what ppc32 does.
>
> Uhm, I meant moving the hunk which hides __divdi3 and friends too. Wouldn't
> this save some PLT entries for implicit uses of this functions on platforms
> that don't version&export them? Or is it enough if they are not listed in
> any Version file to accomplish that?

Hmm, maybe even better, would something along the patch below be acceptable 
for you? It's incomplete, but it should show you the idea.

If it's OK, I'll finish it and add the other platforms CPPFLAGS-divdi3.c 
Makefile entries.
Any comments/change requests?

Franz.

-------------- next part --------------
Index: sysdeps/i386/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- sysdeps/i386/Makefile	28 Feb 2002 19:37:11 -0000	1.12
+++ sysdeps/i386/Makefile	13 Sep 2002 16:54:12 -0000
@@ -9,6 +9,7 @@ ifeq ($(subdir),csu)
 # On i686 we must avoid generating the trampoline functions generated
 # to get the GOT pointer.
 CFLAGS-initfini.s += -march=i386 -mcpu=i386
+CPPFLAGS-divdi3.c += -DDIVDI3_COMPAT_VERSION=GLIBC_2_0 -DDIVDI3_DEFAULT_VERSION=GLIBC_2.0
 
 ifeq (yes,$(build-shared))
 # Compatibility
Index: sysdeps/powerpc/powerpc32/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/powerpc32/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- sysdeps/powerpc/powerpc32/Makefile	5 Sep 2002 09:49:38 -0000	1.1
+++ sysdeps/powerpc/powerpc32/Makefile	13 Sep 2002 16:54:13 -0000
@@ -34,9 +34,9 @@ endif
 ifeq (yes,$(build-shared))
 # Compatibility
 ifeq (yes,$(have-protected))
-CPPFLAGS-divdi3.c = -DHAVE_DOT_HIDDEN
 CPPFLAGS-libgcc-compat.S = -DHAVE_DOT_HIDDEN
 endif
+CPPFLAGS-divdi3.c += -DDIVDI3_COMPAT_VERSION=GLIBC_2_0 -DDIVDI3_VERSION=GLIBC_2.0
 sysdep_routines += divdi3 libgcc-compat
 shared-only-routines += divdi3 libgcc-compat
 endif
Index: sysdeps/wordsize-32/divdi3.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/wordsize-32/divdi3.c,v
retrieving revision 1.4
diff -u -p -r1.4 divdi3.c
--- sysdeps/wordsize-32/divdi3.c	25 Jul 2002 08:17:14 -0000	1.4
+++ sysdeps/wordsize-32/divdi3.c	13 Sep 2002 16:54:13 -0000
@@ -314,12 +314,14 @@ __moddi3 (DWtype u, DWtype v)
     w = -w;
   return w;
 }
+INTDEF(__moddi3)
 
 UDWtype
 __udivdi3 (UDWtype u, UDWtype v)
 {
   return __udivmoddi4 (u, v, NULL);
 }
+INTDEF(__udivdi3)
 
 UDWtype
 __umoddi3 (UDWtype u, UDWtype v)
@@ -329,3 +331,29 @@ __umoddi3 (UDWtype u, UDWtype v)
   __udivmoddi4 (u, v, &w);
   return w;
 }
+INTDEF(__umoddi3)
+
+#ifdef HAVE_DOT_HIDDEN
+asm (".hidden __divdi3");
+asm (".hidden __udivdi3");
+asm (".hidden __moddi3");
+asm (".hidden __umoddi3");
+#endif
+
+#include <shlib-compat.h>
+
+#if defined DIVDI3_VERSION
+#if SHLIB_COMPAT(libc, DIVDI3_COMPAT_VERSION, GLIBC_2_2_6)
+symbol_version (INTUSE (__divdi3), __divdi3, DIVDI3_VERSION);
+symbol_version (INTUSE (__udivdi3), __udivdi3, DIVDI3_VERSION);
+symbol_version (INTUSE (__moddi3), __moddi3, DIVDI3_VERSION);
+symbol_version (INTUSE (__umoddi3), __umoddi3, DIVDI3_VERSION);
+#endif
+#elif defined DIVDI3_DEFAULT_VERSION
+#if SHLIB_COMPAT(libc, DIVDI3_COMPAT_VERSION, GLIBC_2_2_6)
+default_symbol_version (INTUSE (__divdi3), __divdi3, DIVDI3_DEFAULT_VERSION);
+default_symbol_version (INTUSE (__udivdi3), __udivdi3, DIVDI3_DEFAULT_VERSION);
+default_symbol_version (INTUSE (__moddi3), __moddi3, DIVDI3_DEFAULT_VERSION);
+default_symbol_version (INTUSE (__umoddi3), __umoddi3, DIVDI3_DEFAULT_VERSION);
+#endif
+#endif
--- /dev/null	Thu Jan  1 01:00:00 1970
+++ sysdeps/wordsize-32/Makefile	Fri Sep 13 19:04:15 2002
@@ -0,0 +1,9 @@
+ifeq ($(subdir),csu)
+ifeq (yes,$(build-shared))
+ifeq (yes,$(have-protected))
+CPPFLAGS-divdi3.c += -DHAVE_DOT_HIDDEN
+endif
+sysdep_routines += divdi3
+shared-only-routines += divdi3
+endif
+endif


More information about the Libc-alpha mailing list