[PATCH] Centralize divdi3.c handling on 32-bit platforms

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Sun Sep 15 11:28:00 GMT 2002


Hi,

as promised, here is a patch to centralize divdi3.c handling, based on Jakub's 
patch. Tested on powerpc-linux-gnu.

Depending on the defines, it handles things a bit differently:

- on platforms that define neither DIVDI3_VERSION nor DIVDI3_DEFAULT_VERSION, 
it will create hidden definitions of __[u]divdi3/__[u]moddi3 and local 
definitions for their *_internal counterparts

- on platforms defining DIVDI3_VERSION, there will be a local *_internal 
definition, a hidden definition and a global definition with runtime version

- on platforms defining DIVDI3_DEFAULT_VERSION, there will be a local 
*_internal definition and a global definition with linktime version (an 
additional hidden definition, saving some PLT entries, would collide with the 
default version)

Franz.


	* sysdeps/arm/Makefile: Delete file.
	* sysdeps/i386/Makefile: Delete obsoleted db2 handling.
	(csu/sysdep_routines): Remove divdi3.
	(csu/shared_only_routines): Remove divdi3.
	(CPPFLAGS-divdi3.c): New macro.
	* sysdeps/m68k/Makefile (csu/sysdep_routines): Remove divdi3.
	(csu/shared_only_routines): Remove divdi3.
	(CPPFLAGS-divdi3.c): New macro.
	* sysdeps/s390/s390-32/Makefile (csu/sysdep_routines): Remove divdi3.
	(csu/shared_only_routines): Remove divdi3.
	(CPPFLAGS-divdi3.c): New macro.
	* sysdeps/powerpc/powerpc32/Makefile (csu/sysdep_routines): Remove divdi3.
	(csu/shared_only_routines): Remove divdi3.
	(CPPFLAGS-divdi3.c): New macro.
	* sysdeps/powerpc/powerpc32/divdi3.c: Delete file.
	* sysdeps/sh/Makefile (csu/sysdep_routines): Remove divdi3.
	(csu/shared_only_routines): Remove divdi3.
	* sysdeps/wordsize-32/Makefile: New file.
	* sysdeps/wordsize-32/divdi3.c: Add version handling.

-------------- next part --------------
Index: sysdeps/arm/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/arm/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- sysdeps/arm/Makefile	12 Aug 2002 19:36:38 -0000	1.1
+++ sysdeps/arm/Makefile	15 Sep 2002 14:39:59 -0000
@@ -1,7 +0,0 @@
-ifeq ($(subdir),csu)
-ifeq (yes,$(build-shared))
-# Compatibility
-sysdep_routines += divdi3
-shared-only-routines += divdi3
-endif
-endif
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	15 Sep 2002 14:39:59 -0000
@@ -10,16 +10,9 @@ ifeq ($(subdir),csu)
 # to get the GOT pointer.
 CFLAGS-initfini.s += -march=i386 -mcpu=i386
 
-ifeq (yes,$(build-shared))
-# Compatibility
-sysdep_routines += divdi3
-shared-only-routines += divdi3
-endif
-endif
-
-ifeq ($(subdir),db2)
-CPPFLAGS += -DHAVE_SPINLOCKS=1 -DHAVE_ASSEM_X86_GCC=1
-endif
+CPPFLAGS-divdi3.c += -DDIVDI3_DEFAULT_VERSION=GLIBC_2.0 \
+		     -DDIVDI3_COMPAT_INTRODUCED=GLIBC_2_0 \
+		     -DDIVDI3_COMPAT_OBSOLETED=GLIBC_2_2_6
 
 ifeq ($(subdir),gmon)
 sysdep_routines += i386-mcount
Index: sysdeps/m68k/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/m68k/Makefile,v
retrieving revision 1.21
diff -u -p -r1.21 Makefile
--- sysdeps/m68k/Makefile	28 Feb 2002 19:37:12 -0000	1.21
+++ sysdeps/m68k/Makefile	15 Sep 2002 14:39:59 -0000
@@ -30,16 +30,12 @@ pic-ccflag = -fpic
 # Make sure setjmp.c is compiled with a frame pointer
 CFLAGS-setjmp.c := -fno-omit-frame-pointer
 
+CPPFLAGS-divdi3.c += -DDIVDI3_VERSION=GLIBC_2.0 \
+		     -DDIVDI3_COMPAT_INTRODUCED=GLIBC_2_0 \
+		     -DDIVDI3_COMPAT_OBSOLETED=GLIBC_2_2_6
+
 # The 68k `long double' is a distinct type we support.
 long-double-fcts = yes
-
-ifeq ($(subdir),csu)
-ifeq (yes,$(build-shared))
-# Compatibility
-sysdep_routines += divdi3
-shared-only-routines += divdi3
-endif
-endif
 
 ifeq ($(subdir),elf)
 CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
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	15 Sep 2002 14:39:59 -0000
@@ -34,11 +34,13 @@ endif
 ifeq (yes,$(build-shared))
 # Compatibility
 ifeq (yes,$(have-protected))
-CPPFLAGS-divdi3.c = -DHAVE_DOT_HIDDEN
 CPPFLAGS-libgcc-compat.S = -DHAVE_DOT_HIDDEN
 endif
-sysdep_routines += divdi3 libgcc-compat
-shared-only-routines += divdi3 libgcc-compat
+CPPFLAGS-divdi3.c += -DDIVDI3_VERSION=GLIBC_2.0 \
+		     -DDIVDI3_COMPAT_INTRODUCED=GLIBC_2_0 \
+		     -DDIVDI3_COMPAT_OBSOLETED=GLIBC_2_2_6
+sysdep_routines += libgcc-compat
+shared-only-routines += libgcc-compat
 endif
 endif
 
Index: sysdeps/s390/s390-32/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/s390/s390-32/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- sysdeps/s390/s390-32/Makefile	28 Feb 2002 19:37:13 -0000	1.2
+++ sysdeps/s390/s390-32/Makefile	15 Sep 2002 14:39:59 -0000
@@ -1,12 +1,8 @@
 pic-ccflag = -fpic
 
-ifeq ($(subdir),csu)
-ifeq (yes,$(build-shared))
-# Compatibility
-sysdep_routines += divdi3
-shared-only-routines += divdi3
-endif
-endif
+CPPFLAGS-divdi3.c += -DDIVDI3_VERSION=GLIBC_2.0 \
+		     -DDIVDI3_COMPAT_INTRODUCED=GLIBC_2_0 \
+		     -DDIVDI3_COMPAT_OBSOLETED=GLIBC_2_2_6
 
 ifeq ($(subdir),gmon)
 sysdep_routines += s390-mcount
Index: sysdeps/sh/Makefile
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/sh/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- sysdeps/sh/Makefile	26 Aug 2002 11:39:59 -0000	1.2
+++ sysdeps/sh/Makefile	15 Sep 2002 14:39:59 -0000
@@ -1,11 +1,3 @@
 ifeq ($(subdir),gmon)
 sysdep_routines += _mcount
 endif
-
-ifeq ($(subdir),csu)
-ifeq (yes,$(build-shared))
-# Compatibility
-sysdep_routines += divdi3
-shared-only-routines += divdi3
-endif
-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	15 Sep 2002 14:40:00 -0000
@@ -294,7 +294,7 @@ __divdi3 (DWtype u, DWtype v)
     w = -w;
   return w;
 }
-INTDEF(__divdi3)
+INTDEF (__divdi3)
 
 DWtype
 __moddi3 (DWtype u, DWtype v)
@@ -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,28 @@ __umoddi3 (UDWtype u, UDWtype v)
   __udivmoddi4 (u, v, &w);
   return w;
 }
+INTDEF (__umoddi3)
+
+#if defined DIVDI3_VERSION || !defined DIVDI3_DEFAULT_VERSION
+extern DWtype __divdi3 (DWtype u, DWtype v) attribute_hidden;
+extern DWtype __moddi3 (DWtype u, DWtype v) attribute_hidden;
+extern UDWtype __udivdi3 (UDWtype u, UDWtype v) attribute_hidden;
+extern UDWtype __umoddi3 (UDWtype u, UDWtype v) attribute_hidden;
+#endif
+
+#if defined DIVDI3_VERSION || defined DIVDI3_DEFAULT_VERSION
+# include <shlib-compat.h>
+# if SHLIB_COMPAT(libc, DIVDI3_COMPAT_INTRODUCED, DIVDI3_COMPAT_OBSOLETED)
+#  if defined DIVDI3_VERSION
+symbol_version (INTUSE (__divdi3), __divdi3, DIVDI3_VERSION);
+symbol_version (INTUSE (__moddi3), __moddi3, DIVDI3_VERSION);
+symbol_version (INTUSE (__udivdi3), __udivdi3, DIVDI3_VERSION);
+symbol_version (INTUSE (__umoddi3), __umoddi3, DIVDI3_VERSION);
+#  elif defined DIVDI3_DEFAULT_VERSION
+default_symbol_version (INTUSE (__divdi3), __divdi3, DIVDI3_DEFAULT_VERSION);
+default_symbol_version (INTUSE (__moddi3), __moddi3, DIVDI3_DEFAULT_VERSION);
+default_symbol_version (INTUSE (__udivdi3), __udivdi3, DIVDI3_DEFAULT_VERSION);
+default_symbol_version (INTUSE (__umoddi3), __umoddi3, DIVDI3_DEFAULT_VERSION);
+#  endif
+# endif
+#endif
--- /dev/null	Thu Oct  4 06:30:44 2001
+++ sysdeps/wordsize-32/Makefile	Sun Sep 15 07:39:30 2002
@@ -0,0 +1,6 @@
+ifeq ($(subdir),csu)
+ifeq (yes,$(build-shared))
+sysdep_routines += divdi3
+shared-only-routines += divdi3
+endif
+endif


More information about the Libc-alpha mailing list