about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--Makefile2
-rw-r--r--Makerules11
-rw-r--r--csu/Makefile4
-rw-r--r--dlfcn/Makefile3
-rw-r--r--elf/Makefile3
-rw-r--r--extra-modules.mk9
-rw-r--r--include/libc-symbols.h3
-rw-r--r--sysdeps/generic/symbol-hacks.h1
-rw-r--r--sysdeps/wordsize-32/divdi3.c6
-rw-r--r--sysdeps/wordsize-32/symbol-hacks.h30
11 files changed, 80 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e4d70355b5..75f518b35a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-03-08  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makerules: Use extra-modules.mk if modules-names is defined.
+	* extra-modules.mk: New file.
+	* dlfcn/Makefile (CPPFLAGS-modcxaatexit.c): Removed.
+	* elf/Makefile (CFLAGS-interp.c): Add -DNOT_IN_libc=1.
+	* csu/Makefile ($(objpfx)version-info.h): Pass -DNOT_IN_libc=1 to
+	compiler.
+	* Makefile (distribute): Add symbol-hacks.h.
+	* sysdeps/generic/symbol-hacks.h: New file.
+	* sysdeps/wordsize-32/symbol-hacks.h: New file.
+	* sysdeps/wordsize-32/divdi3.c: Define *_internal aliases for __divdi3,
+	__moddi3, __udivdi3, and __umoddi3.
+	* include/libc-symbols.h: Include <symbol-hacks.h>.
+
 2004-03-08  Jeroen Dekkers  <jeroen@dekkers.cx>
 
 	* elf/rtld.c (_rtld_global_ro) [MAP_COPY]: Don't set _dl_unload_cache.
diff --git a/Makefile b/Makefile
index ab353c7df7..96c34d632d 100644
--- a/Makefile
+++ b/Makefile
@@ -285,7 +285,7 @@ distribute  :=	README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS	\
 		include/shlib-compat.h include/pthread.h Versions.def	\
 		cppflags-iterator.mk tls.make.c				\
 		include/stubs-prologue.h include/gnu/stubs.h		\
-		include/atomic.h bits/atomic.h				\
+		include/atomic.h bits/atomic.h symbol-hacks.h		\
 		INTERFACE CONFORMANCE NAMESPACE LICENSES	        \
 		$(addprefix scripts/,					\
 			    rellns-sh config.sub config.guess		\
diff --git a/Makerules b/Makerules
index 1018b43b3e..970d1a4e32 100644
--- a/Makerules
+++ b/Makerules
@@ -661,6 +661,17 @@ ifdef extra-libs
 extra-libs-left := $(extra-libs)
 include $(patsubst %,$(..)extra-lib.mk,$(extra-libs))
 endif
+
+
+# The makefile may define $(modules-names) # to build additional
+# modules.
+ifdef modules-names
+# extra-lib.mk is included once for each extra lib to define rules
+# to build it, and to add its objects to the various variables.
+# During its evaluation, $(lib) is set to the name of the library.
+extra-modules-left := $(modules-names)
+include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
+endif
 
 +depfiles := $(sources:.c=.d) \
 	     $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
diff --git a/csu/Makefile b/csu/Makefile
index b1fd32d7a6..f400a58686 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -1,5 +1,5 @@
 # Makefile for csu code for GNU C library.
-# Copyright (C) 1995,96,97,98,99,2000,01,02,2003 Free Software Foundation, Inc.
+# Copyright (C) 1995-2003, 2004 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
@@ -217,7 +217,7 @@ $(objpfx)version-info.h: $(common-objpfx)config.make $(all-Banner-files)
 	$(make-target-directory)
 	(case $(config-os) in \
 	   linux*) version=`(echo -e "#include <linux/version.h>\nUTS_RELEASE"\
-			     | $(CC) $(CPPFLAGS) -E -P - | \
+			     | $(CC) $(CPPFLAGS) -E -P - -DNOT_IN_libc=1 | \
 			     sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\
 		   if [ -z "$$version" ]; then \
 		     if [ -r /proc/version ]; then \
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index f55d98b955..b9ed430199 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1995-2002, 2003, 2004 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
@@ -99,7 +99,6 @@ $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
 $(objpfx)tstatexit: $(libdl)
 $(objpfx)tstatexit.out: $(objpfx)tstatexit $(objpfx)modatexit.so
 
-CPPFLAGS-modcxaatexit.c = -DNOT_IN_libc
 $(objpfx)tstcxaatexit: $(libdl)
 $(objpfx)tstcxaatexit.out: $(objpfx)tstcxaatexit $(objpfx)modcxaatexit.so
 
diff --git a/elf/Makefile b/elf/Makefile
index b1bd6f47d9..68474825c7 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -273,7 +273,8 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
 	rm -f $@.lds
 
 # interp.c exists just to get this string into the libraries.
-CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"'
+CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
+		  -DNOT_IN_libc=1
 $(objpfx)interp.os: $(common-objpfx)config.make
 
 ifneq (ld.so,$(rtld-installed-name))
diff --git a/extra-modules.mk b/extra-modules.mk
new file mode 100644
index 0000000000..c7ed850995
--- /dev/null
+++ b/extra-modules.mk
@@ -0,0 +1,9 @@
+# This file is included several times in a row, once
+# for each element of $(modules-names).  $(extra-modules-left)
+# is initialized first to $(modules-names) so that with each
+# inclusion, we advance $(module) to the next name.
+
+module := $(firstword $(extra-modules-left))
+extra-modules-left := $(filter-out $(module),$(extra-modules-left))
+
+CPPFLAGS-$(module).c += -DNOT_IN_libc
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 399b4b9226..93b5f9d454 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -756,4 +756,7 @@ for linking")
 # define libc_hidden_builtin_ver(local, name)
 #endif
 
+/* Get some dirty hacks.  */
+#include <symbol-hacks.h>
+
 #endif /* libc-symbols.h */
diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
new file mode 100644
index 0000000000..bc7b4c4441
--- /dev/null
+++ b/sysdeps/generic/symbol-hacks.h
@@ -0,0 +1 @@
+/* Fortunately nothing to do.  */
diff --git a/sysdeps/wordsize-32/divdi3.c b/sysdeps/wordsize-32/divdi3.c
index 122ffcae8c..94fb008f1f 100644
--- a/sysdeps/wordsize-32/divdi3.c
+++ b/sysdeps/wordsize-32/divdi3.c
@@ -1,5 +1,5 @@
 /* 64-bit multiplication and division
-   Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003
+   Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -294,6 +294,7 @@ __divdi3 (DWtype u, DWtype v)
     w = -w;
   return w;
 }
+strong_alias (__divdi3, __divdi3_internal)
 
 DWtype
 __moddi3 (DWtype u, DWtype v)
@@ -313,12 +314,14 @@ __moddi3 (DWtype u, DWtype v)
     w = -w;
   return w;
 }
+strong_alias (__moddi3, __moddi3_internal)
 
 UDWtype
 __udivdi3 (UDWtype u, UDWtype v)
 {
   return __udivmoddi4 (u, v, NULL);
 }
+strong_alias (__udivdi3, __udivdi3_internal)
 
 UDWtype
 __umoddi3 (UDWtype u, UDWtype v)
@@ -328,6 +331,7 @@ __umoddi3 (UDWtype u, UDWtype v)
   __udivmoddi4 (u, v, &w);
   return w;
 }
+strong_alias (__umoddi3, __umoddi3_internal)
 
 /* We declare these with compat_symbol so that they are not visible at
    link time.  Programs must use the functions from libgcc.  */
diff --git a/sysdeps/wordsize-32/symbol-hacks.h b/sysdeps/wordsize-32/symbol-hacks.h
new file mode 100644
index 0000000000..ee53e1257f
--- /dev/null
+++ b/sysdeps/wordsize-32/symbol-hacks.h
@@ -0,0 +1,30 @@
+/* Hacks needed for symbol manipulation.
+   Copyright (C) 2004 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.  */
+
+/* A very dirty trick: gcc emits references to __divdi3, __udivdi3,
+   __moddi3, and __umoddi3.  These functions are exported and
+   therefore we get PLTs.  Unnecessarily so.  Changing gcc is a big
+   task which might not be worth it so we play tricks with the
+   assembler.  */
+#if !defined __ASSEMBLER__ && !defined NOT_IN_libc && defined SHARED
+asm ("__divdi3 = __divdi3_internal");
+asm ("__udivdi3 = __udivdi3_internal");
+asm ("__moddi3 = __moddi3_internal");
+asm ("__umoddi3 = __umoddi3_internal");
+#endif