This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Hide __[u]{div,mod}di3


This makes sure that libc does not export __divdi3, etc., at link
time, and saves the corresponding PLT entries.  The ugly hack in
lldiv.c wasn't complete anyway, since it missed the reference to
__moddi3.  The ppc version is not needed any more.

Andreas.

2003-01-26  Andreas Schwab  <schwab@suse.de>

	* sysdeps/wordsize-32/divdi3.c: Export the functions only as
	compatibility symbols.  Remove INTDEF for __divdi3.
	* sysdeps/wordsize-32/lldiv.c: Don't use __divdi3_internal.
	* sysdeps/powerpc/powerpc32/divdi3.c: Remove.
	* sysdeps/powerpc/powerpc32/Makefile (CPPFLAGS-divdi3.c): Don't
	define.
	* sysdeps/powerpc/powerpc32/Dist: Remove divdi3.c.

--- sysdeps/powerpc/powerpc32/Dist.~1.1.~	2002-09-05 11:35:02.000000000 +0200
+++ sysdeps/powerpc/powerpc32/Dist	2003-01-26 01:41:53.000000000 +0100
@@ -1,4 +1,3 @@
-divdi3.c
 dl-machine.c
 dl-start.S
 libgcc-compat.S
--- sysdeps/powerpc/powerpc32/Makefile.~1.3.~	2002-10-07 10:35:15.000000000 +0200
+++ sysdeps/powerpc/powerpc32/Makefile	2003-01-26 01:40:12.000000000 +0100
@@ -34,7 +34,6 @@ 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 += libgcc-compat
--- sysdeps/powerpc/powerpc32/divdi3.c	2002-09-05 10:31:00.000000000 +0200
+++ /dev/null	2002-10-07 10:49:18.000000000 +0200
@@ -1,43 +0,0 @@
-/* 64-bit multiplication and division libgcc routines for 32-bit PowerPC
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define _DIVDI3_C
-#include <sysdeps/wordsize-32/divdi3.c>
-
-INTDEF (__udivdi3);
-INTDEF (__moddi3);
-INTDEF (__umoddi3);
-
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden __divdi3");
-asm (".hidden __udivdi3");
-asm (".hidden __moddi3");
-asm (".hidden __umoddi3");
-#endif
-
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6)
-
-symbol_version (INTUSE (__divdi3), __divdi3, GLIBC_2.0);
-symbol_version (INTUSE (__udivdi3), __udivdi3, GLIBC_2.0);
-symbol_version (INTUSE (__moddi3), __moddi3, GLIBC_2.0);
-symbol_version (INTUSE (__umoddi3), __umoddi3, GLIBC_2.0);
-
-#endif

Diff finished at Sun Jan 26 01:29:01
--- sysdeps/wordsize-32/divdi3.c.~1.4.~	2002-07-25 10:38:03.000000000 +0200
+++ sysdeps/wordsize-32/divdi3.c	2003-01-26 00:55:56.000000000 +0100
@@ -1,5 +1,5 @@
 /* 64-bit multiplication and division
-   Copyright (C) 1989, 1992-1999, 2000, 2001, 2002
+   Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -294,7 +294,6 @@ __divdi3 (DWtype u, DWtype v)
     w = -w;
   return w;
 }
-INTDEF(__divdi3)
 
 DWtype
 __moddi3 (DWtype u, DWtype v)
@@ -329,3 +328,13 @@ __umoddi3 (UDWtype u, UDWtype v)
   __udivmoddi4 (u, v, &w);
   return w;
 }
+
+/* We declare these with compat_symbol so that they are not visible at
+   link time.  Programs must use the functions from libgcc.  */
+#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
+# include <shlib-compat.h>
+compat_symbol (libc, __divdi3, __divdi3, GLIBC_2_0);
+compat_symbol (libc, __moddi3, __moddi3, GLIBC_2_0);
+compat_symbol (libc, __udivdi3, __udivdi3, GLIBC_2_0);
+compat_symbol (libc, __umoddi3, __umoddi3, GLIBC_2_0);
+#endif
--- sysdeps/wordsize-32/lldiv.c.~1.4.~	2002-07-25 10:38:03.000000000 +0200
+++ sysdeps/wordsize-32/lldiv.c	2003-01-26 01:01:43.000000000 +0100
@@ -21,13 +21,6 @@
 
 #include <inttypes.h>
 
-#ifdef SHARED
-/* This is an ugly trick.  We cause the C code generated for the code
-   in lldiv.c to use __divdi3_internal instead of __divdi3 by defining
-   an alias on the assembler level.  */
-asm ("__divdi3 = __divdi3_internal");
-#endif
-
 #include <sysdeps/generic/lldiv.c>
 
 #undef imaxdiv


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