about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-06 08:19:29 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-06 08:19:29 +0000
commit154d10bdf1984f4fe28f898e07bc25c5367f443e (patch)
tree10b4e36bf9d3fd223d680a054e744bf84bb66212
parentdd70526e8a07e95336ee87e1d968deafa8b5f34c (diff)
downloadglibc-154d10bdf1984f4fe28f898e07bc25c5367f443e.tar.gz
glibc-154d10bdf1984f4fe28f898e07bc25c5367f443e.tar.xz
glibc-154d10bdf1984f4fe28f898e07bc25c5367f443e.zip
Update.
	* elf/Versions: Remove functions which are not exported anymore.
	* dlfcn/dlerror.c: Call ld.so functions through GLSO.
	* dlfcn/dlinfo.c: Likewise.
	* elf/dl-close.c: Likewise.
	* elf/dl-libc.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/dl-sym.c: Likewise.
	* sysdeps/generic/libc-start.c: Likewise.
	* elf/dl-debug.c: Remove *_internal definition.  Don't use INTUSE for
	functions which are not exported anymore.
	* elf/dl-deps.c: Likewise.
	* elf/dl-dst.h: Likewise.
	* elf/dl-error.c: Likewise.
	* elf/dl-fini.c: Likewise.
	* elf/dl-init.c: Likewise.
	* elf/dl-load.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* elf/dl-misc.c: Likewise.
	* elf/dl-profile.c: Likewise.
	* elf/dl-profstub.c: Likewise.
	* elf/dl-reloc.c: Likewise.
	* elf/dl-runtime.c: Likewise.
	* elf/dl-version.c: Likewise.
	* elf/do-lookup.h: Likewise.
	* include/dlfcn.h: Likewise.
	* sysdeps/generic/dl-cache.c: Likewise.
	* sysdeps/generic/dl-fptr.c: Likewise.
	* sysdeps/generic/dl-origin.c: Likewise.
	* sysdeps/generic/dl-sysdep.c: Likewise.
	* sysdeps/generic/dl-tls.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
	* sysdeps/i386/dl-tls.h: Likewise.
	* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
	* elf/rtld.c: Likewise.  Export function though _rtld_global_ro.

	* generic/dl-fptr.c: Likewise.
	* mach/hurd/dl-sysdep.c: Likewise.
	* unix/sysv/linux/ia64/dl-static.c: Likewise.
	* unix/sysv/linux/ia64/getpagesize.c: Likewise.
	* unix/sysv/linux/m68k/getpagesize.c: Likewise.
	* unix/sysv/linux/sparc/sparc32/getpagesize.c: Likewise.
-rw-r--r--ChangeLog41
-rw-r--r--dlfcn/dlerror.c8
-rw-r--r--dlfcn/dlinfo.c6
-rw-r--r--elf/Versions14
-rw-r--r--elf/dl-close.c12
-rw-r--r--elf/dl-debug.c5
-rw-r--r--elf/dl-deps.c66
-rw-r--r--elf/dl-dst.h24
-rw-r--r--elf/dl-error.c8
-rw-r--r--elf/dl-fini.c15
-rw-r--r--elf/dl-init.c14
-rw-r--r--elf/dl-libc.c16
-rw-r--r--elf/dl-load.c45
-rw-r--r--elf/dl-lookup.c37
-rw-r--r--elf/dl-misc.c1
-rw-r--r--elf/dl-open.c59
-rw-r--r--elf/dl-profile.c1
-rw-r--r--elf/dl-profstub.c7
-rw-r--r--elf/dl-reloc.c44
-rw-r--r--elf/dl-runtime.c36
-rw-r--r--elf/dl-sym.c66
-rw-r--r--elf/dl-version.c14
-rw-r--r--elf/do-lookup.h6
-rw-r--r--elf/rtld.c101
-rw-r--r--include/dlfcn.h4
-rw-r--r--sysdeps/generic/dl-cache.c5
-rw-r--r--sysdeps/generic/dl-fptr.c20
-rw-r--r--sysdeps/generic/dl-origin.c2
-rw-r--r--sysdeps/generic/dl-sysdep.c4
-rw-r--r--sysdeps/generic/dl-tls.c28
-rw-r--r--sysdeps/generic/ldsodefs.h128
-rw-r--r--sysdeps/generic/libc-start.c4
-rw-r--r--sysdeps/i386/dl-tls.h10
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c4
-rw-r--r--sysdeps/unix/sysv/linux/dl-origin.c2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-static.c10
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getpagesize.c6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getpagesize.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c8
39 files changed, 465 insertions, 422 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e1a0cc9e5..d94b82f358 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,40 @@
 2004-03-05  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/Versions: Remove functions which are not exported anymore.
+	* dlfcn/dlerror.c: Call ld.so functions through GLSO.
+	* dlfcn/dlinfo.c: Likewise.
+	* elf/dl-close.c: Likewise.
+	* elf/dl-libc.c: Likewise.
+	* elf/dl-open.c: Likewise.
+	* elf/dl-sym.c: Likewise.
+	* sysdeps/generic/libc-start.c: Likewise.
+	* elf/dl-debug.c: Remove *_internal definition.  Don't use INTUSE for
+	functions which are not exported anymore.
+	* elf/dl-deps.c: Likewise.
+	* elf/dl-dst.h: Likewise.
+	* elf/dl-error.c: Likewise.
+	* elf/dl-fini.c: Likewise.
+	* elf/dl-init.c: Likewise.
+	* elf/dl-load.c: Likewise.
+	* elf/dl-lookup.c: Likewise.
+	* elf/dl-misc.c: Likewise.
+	* elf/dl-profile.c: Likewise.
+	* elf/dl-profstub.c: Likewise.
+	* elf/dl-reloc.c: Likewise.
+	* elf/dl-runtime.c: Likewise.
+	* elf/dl-version.c: Likewise.
+	* elf/do-lookup.h: Likewise.
+	* include/dlfcn.h: Likewise.
+	* sysdeps/generic/dl-cache.c: Likewise.
+	* sysdeps/generic/dl-fptr.c: Likewise.
+	* sysdeps/generic/dl-origin.c: Likewise.
+	* sysdeps/generic/dl-sysdep.c: Likewise.
+	* sysdeps/generic/dl-tls.c: Likewise.
+	* sysdeps/generic/ldsodefs.h: Likewise.
+	* sysdeps/i386/dl-tls.h: Likewise.
+	* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
+	* elf/rtld.c: Likewise.  Export function though _rtld_global_ro.
+
 	* sysdeps/generic/ldsodefs.h (struct rtld_global): Move
 	dl_debug_fd to rtld_global_ro.
 	* elf/rtld.c: Use GLRO instead of GL for dl_debug_fd.
@@ -79,6 +114,12 @@
 	* sysdeps/ia64/dl-machine.h: Likewise.
 	* sysdeps/arm/dl-machine.h: Likewise.
 	* sysdeps/alpha/dl-machine.h: Likewise.
+	* generic/dl-fptr.c: Likewise.
+	* mach/hurd/dl-sysdep.c: Likewise.
+	* unix/sysv/linux/ia64/dl-static.c: Likewise.
+	* unix/sysv/linux/ia64/getpagesize.c: Likewise.
+	* unix/sysv/linux/m68k/getpagesize.c: Likewise.
+	* unix/sysv/linux/sparc/sparc32/getpagesize.c: Likewise.
 
 2004-03-04  Ulrich Drepper  <drepper@redhat.com>
 
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index f732deb868..1cde04b080 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -1,6 +1,5 @@
 /* Return error detail for failing <dlfcn.h> functions.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003
-	Free Software Foundation, Inc.
+   Copyright (C) 1995-2000,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
@@ -24,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <bits/libc-lock.h>
+#include <ldsodefs.h>
 
 /* Type for storing results of dynamic loading actions.  */
 struct dl_action_result
@@ -141,8 +141,8 @@ _dlerror_run (void (*operate) (void *), void *args)
       result->errstring = NULL;
     }
 
-  result->errcode = _dl_catch_error (&result->objname, &result->errstring,
-				     operate, args);
+  result->errcode = GLRO(dl_catch_error) (&result->objname, &result->errstring,
+					  operate, args);
 
   /* If no error we mark that no error string is available.  */
   result->returned = result->errstring == NULL;
diff --git a/dlfcn/dlinfo.c b/dlfcn/dlinfo.c
index 37177f1f1b..7e7f1c759b 100644
--- a/dlfcn/dlinfo.c
+++ b/dlfcn/dlinfo.c
@@ -1,5 +1,5 @@
 /* dlinfo -- Get information from the dynamic linker.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -48,7 +48,7 @@ dlinfo_doit (void *argsblock)
 	  break;
 
       if (l == NULL)
-	_dl_signal_error (0, NULL, NULL, N_("\
+	GLRO(dl_signal_error) (0, NULL, NULL, N_("\
 RTLD_SELF used in code not dynamically loaded"));
     }
 #endif
@@ -58,7 +58,7 @@ RTLD_SELF used in code not dynamically loaded"));
     case RTLD_DI_LMID:
     case RTLD_DI_CONFIGADDR:
     default:
-      _dl_signal_error (0, NULL, NULL, N_("unsupported dlinfo request"));
+      GLRO(dl_signal_error) (0, NULL, NULL, N_("unsupported dlinfo request"));
       break;
 
     case RTLD_DI_LINKMAP:
diff --git a/elf/Versions b/elf/Versions
index 709a657775..3797cc4eee 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -46,17 +46,13 @@ ld {
   GLIBC_PRIVATE {
     # Those are in the dynamic linker, but used by libc.so.
     __libc_enable_secure;
-    _dl_argv; _dl_catch_error; _dl_check_map_versions;
-    _dl_debug_printf; _dl_debug_state; _dl_dst_count;
-    _dl_dst_substitute; _dl_init; _dl_lookup_symbol; _dl_lookup_symbol_skip;
-    _dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip;
-    _dl_map_object; _dl_map_object_deps; _dl_out_of_memory;
-    _dl_relocate_object; _dl_signal_error; _dl_start_profile; _dl_starting_up;
-    _dl_unload_cache;
+    _dl_argv;
+    _dl_out_of_memory;
+    _dl_starting_up;
     _rtld_global; _rtld_global_ro;
-    _dl_tls_symaddr; _dl_allocate_tls; _dl_deallocate_tls;
+    _dl_allocate_tls; _dl_deallocate_tls;
     _dl_get_tls_static_info; _dl_allocate_tls_init;
-    _dl_get_origin; _dl_tls_setup; _dl_rtld_di_serinfo;
+    _dl_tls_setup; _dl_rtld_di_serinfo;
     _dl_make_stack_executable;
   }
 }
diff --git a/elf/dl-close.c b/elf/dl-close.c
index c63dabbfe1..62c257ce4f 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -125,7 +125,7 @@ _dl_close (void *_map)
     return;
 
   if (__builtin_expect (map->l_opencount, 1) == 0)
-    _dl_signal_error (0, map->l_name, NULL, N_("shared object not open"));
+    GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open"));
 
   /* Acquire the lock.  */
   __rtld_lock_lock_recursive (GL(dl_load_lock));
@@ -135,8 +135,8 @@ _dl_close (void *_map)
     {
       /* There are still references to this object.  Do nothing more.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-	_dl_debug_printf ("\nclosing file=%s; opencount == %u\n",
-			  map->l_name, map->l_opencount);
+	GLRO(dl_debug_printf) ("\nclosing file=%s; opencount == %u\n",
+				map->l_name, map->l_opencount);
 
       /* Decrement the object's reference counter, not the dependencies'.  */
       --map->l_opencount;
@@ -225,7 +225,7 @@ _dl_close (void *_map)
 	{
 	  /* When debugging print a message first.  */
 	  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-	    _dl_debug_printf ("\ncalling fini: %s\n\n", imap->l_name);
+	    GLRO(dl_debug_printf) ("\ncalling fini: %s\n\n", imap->l_name);
 
 	  /* Call its termination function.  Do not do it for
 	     half-cooked objects.  */
@@ -318,7 +318,7 @@ _dl_close (void *_map)
 
   /* Notify the debugger we are about to remove some loaded objects.  */
   _r_debug.r_state = RT_DELETE;
-  _dl_debug_state ();
+  GLRO(dl_debug_state) ();
 
 #ifdef USE_TLS
   size_t tls_free_start;
@@ -537,7 +537,7 @@ _dl_close (void *_map)
 
   /* Notify the debugger those objects are finalized and gone.  */
   _r_debug.r_state = RT_CONSISTENT;
-  _dl_debug_state ();
+  GLRO(dl_debug_state) ();
 
   /* Now we can perhaps also remove the modules for which we had
      dependencies because of symbol lookup.  */
diff --git a/elf/dl-debug.c b/elf/dl-debug.c
index e072b685f2..2feb0c5b96 100644
--- a/elf/dl-debug.c
+++ b/elf/dl-debug.c
@@ -1,5 +1,5 @@
 /* Communicate dynamic linker state to the debugger at runtime.
-   Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2000, 2002, 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
@@ -40,7 +40,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase)
       _r_debug.r_version = 1	/* R_DEBUG_VERSION XXX */;
       _r_debug.r_ldbase = ldbase;
       _r_debug.r_map = GL(dl_loaded);
-      _r_debug.r_brk = (ElfW(Addr)) &INTUSE(_dl_debug_state);
+      _r_debug.r_brk = (ElfW(Addr)) &_dl_debug_state;
     }
 
   return &_r_debug;
@@ -55,4 +55,3 @@ void
 _dl_debug_state (void)
 {
 }
-INTDEF (_dl_debug_state)
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index b2e6ec612b..1c383b7b98 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -60,10 +60,10 @@ openaux (void *a)
 {
   struct openaux_args *args = (struct openaux_args *) a;
 
-  args->aux = INTUSE(_dl_map_object) (args->map, args->name, 0,
-				      (args->map->l_type == lt_executable
-				       ? lt_library : args->map->l_type),
-				      args->trace_mode, args->open_mode);
+  args->aux = _dl_map_object (args->map, args->name, 0,
+			      (args->map->l_type == lt_executable
+			       ? lt_library : args->map->l_type),
+			      args->trace_mode, args->open_mode);
 }
 
 static ptrdiff_t
@@ -108,26 +108,26 @@ struct list
 									      \
 	/* DST must not appear in SUID/SGID programs.  */		      \
 	if (INTUSE(__libc_enable_secure))				      \
-	  INTUSE(_dl_signal_error) (0, __str, NULL, N_("\
+	  _dl_signal_error (0, __str, NULL, N_("\
 DST not allowed in SUID/SGID programs"));				      \
 									      \
 	__newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str),  \
 						   __cnt));		      \
 									      \
-	__result = INTUSE(_dl_dst_substitute) (l, __str, __newp, 0);	      \
+	__result = _dl_dst_substitute (l, __str, __newp, 0);	      \
 									      \
 	if (*__result == '\0')						      \
 	  {								      \
 	    /* The replacement for the DST is not known.  We can't	      \
 	       processed.  */						      \
 	    if (fatal)							      \
-	      INTUSE(_dl_signal_error) (0, __str, NULL, N_("\
+	      _dl_signal_error (0, __str, NULL, N_("\
 empty dynamics string token substitution"));				      \
 	    else							      \
 	      {								      \
 		/* This is for DT_AUXILIARY.  */			      \
 		if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))\
-		  INTUSE(_dl_debug_printf) (N_("\
+		  _dl_debug_printf (N_("\
 cannot load auxiliary `%s' because of empty dynamic string token "	      \
 					    "substitution\n"), __str);	      \
 		continue;						      \
@@ -241,8 +241,7 @@ _dl_map_object_deps (struct link_map *map,
 		/* Store the tag in the argument structure.  */
 		args.name = name;
 
-		err = INTUSE(_dl_catch_error) (&objname, &errstring, openaux,
-					       &args);
+		err = _dl_catch_error (&objname, &errstring, openaux, &args);
 		if (__builtin_expect (errstring != NULL, 0))
 		  {
 		    if (err)
@@ -293,16 +292,16 @@ _dl_map_object_deps (struct link_map *map,
 		    /* Say that we are about to load an auxiliary library.  */
 		    if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
 					  0))
-		      INTUSE(_dl_debug_printf) ("load auxiliary object=%s"
-						" requested by file=%s\n",
-						name,
-						l->l_name[0]
-						? l->l_name : rtld_progname);
+		      _dl_debug_printf ("load auxiliary object=%s"
+					" requested by file=%s\n",
+					name,
+					l->l_name[0]
+					? l->l_name : rtld_progname);
 
 		    /* We must be prepared that the addressed shared
 		       object is not available.  */
-		    err = INTUSE(_dl_catch_error) (&objname, &errstring,
-						   openaux, &args);
+		    err = _dl_catch_error (&objname, &errstring, openaux,
+					   &args);
 		    if (__builtin_expect (errstring != NULL, 0))
 		      {
 			/* We are not interested in the error message.  */
@@ -321,15 +320,15 @@ _dl_map_object_deps (struct link_map *map,
 		    /* Say that we are about to load an auxiliary library.  */
 		    if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
 					  0))
-		      INTUSE(_dl_debug_printf) ("load filtered object=%s"
-						" requested by file=%s\n",
-						name,
-						l->l_name[0]
-						? l->l_name : rtld_progname);
+		      _dl_debug_printf ("load filtered object=%s"
+					" requested by file=%s\n",
+					name,
+					l->l_name[0]
+					? l->l_name : rtld_progname);
 
 		    /* For filter objects the dependency must be available.  */
-		    err = INTUSE(_dl_catch_error) (&objname, &errstring,
-						   openaux, &args);
+		    err = _dl_catch_error (&objname, &errstring, openaux,
+					   &args);
 		    if (__builtin_expect (errstring != NULL, 0))
 		      {
 			if (err)
@@ -457,8 +456,8 @@ _dl_map_object_deps (struct link_map *map,
 	  l->l_initfini = (struct link_map **)
 	    malloc ((2 * nneeded + 1) * sizeof needed[0]);
 	  if (l->l_initfini == NULL)
-	    INTUSE(_dl_signal_error) (ENOMEM, map->l_name, NULL,
-				      N_("cannot allocate dependency list"));
+	    _dl_signal_error (ENOMEM, map->l_name, NULL,
+			      N_("cannot allocate dependency list"));
 	  l->l_initfini[0] = l;
 	  memcpy (&l->l_initfini[1], needed, nneeded * sizeof needed[0]);
 	  memcpy (&l->l_initfini[nneeded + 1], l->l_initfini,
@@ -490,8 +489,8 @@ _dl_map_object_deps (struct link_map *map,
     (struct link_map **) malloc ((2 * nlist + 1)
 				 * sizeof (struct link_map *));
   if (map->l_initfini == NULL)
-    INTUSE(_dl_signal_error) (ENOMEM, map->l_name, NULL,
-			      N_("cannot allocate symbol search list"));
+    _dl_signal_error (ENOMEM, map->l_name, NULL,
+		      N_("cannot allocate symbol search list"));
 
 
   map->l_searchlist.r_list = &map->l_initfini[nlist + 1];
@@ -531,7 +530,7 @@ _dl_map_object_deps (struct link_map *map,
 	      /* As current DT_AUXILIARY/DT_FILTER implementation needs to be
 		 rewritten, no need to bother with prelinking the old
 		 implementation.  */
-	      INTUSE(_dl_signal_error) (EINVAL, l->l_name, NULL, N_("\
+	      _dl_signal_error (EINVAL, l->l_name, NULL, N_("\
 Filters not supported with LD_TRACE_PRELINKING"));
 	    }
 
@@ -545,8 +544,8 @@ Filters not supported with LD_TRACE_PRELINKING"));
 					    + (cnt
 					       * sizeof (struct link_map *)));
 	  if (l->l_local_scope[0] == NULL)
-	    INTUSE(_dl_signal_error) (ENOMEM, map->l_name, NULL,
-				      N_("cannot allocate symbol search list"));
+	    _dl_signal_error (ENOMEM, map->l_name, NULL,
+			      N_("cannot allocate symbol search list"));
 	  l->l_local_scope[0]->r_nlist = cnt;
 	  l->l_local_scope[0]->r_list =
 	    (struct link_map **) (l->l_local_scope[0] + 1);
@@ -629,7 +628,6 @@ Filters not supported with LD_TRACE_PRELINKING"));
   map->l_initfini[nlist] = NULL;
 
   if (errno_reason)
-    INTUSE(_dl_signal_error) (errno_reason == -1 ? 0 : errno_reason, objname,
-			   NULL, errstring);
+    _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
+		      NULL, errstring);
 }
-INTDEF (_dl_map_object_deps)
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index b50d6735e3..42bd4185af 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -25,13 +25,12 @@
     const char *__sf = strchr (name, '$');				      \
 									      \
     if (__builtin_expect (__sf != NULL, 0))				      \
-      __cnt = INTUSE(_dl_dst_count) (__sf, is_path);			      \
+      __cnt = _dl_dst_count (__sf, is_path);			      \
 									      \
     __cnt; })
-
-/* Prototype for used function.  */
-extern size_t _dl_dst_count (const char *name, int is_path);
-extern size_t _dl_dst_count_internal (const char *name, int is_path);
+#ifndef IS_IN_rtld
+# define _dl_dst_count GLRO(dl_dst_count)
+#endif
 
 
 /* Guess from the number of DSTs the length of the result string.  */
@@ -67,16 +66,7 @@ extern size_t _dl_dst_count_internal (const char *name, int is_path);
 									      \
     __len; })
 
-/* Find origin of the executable.  */
-extern const char *_dl_get_origin (void);
-extern const char *_dl_get_origin_internal (void);
-
-#ifdef IS_IN_rtld
-# define _dl_get_origin INTUSE(_dl_get_origin)
+#ifndef IS_IN_rtld
+# define _dl_get_origin GLRO(dl_get_origin)
+# define _dl_dst_substitute GLRO(dl_dst_substitute)
 #endif
-
-/* Prototype for used function.  */
-extern char *_dl_dst_substitute (struct link_map *l, const char *name,
-				 char *result, int is_path);
-extern char *_dl_dst_substitute_internal (struct link_map *l, const char *name,
-					  char *result, int is_path);
diff --git a/elf/dl-error.c b/elf/dl-error.c
index f234026701..0ef76c82ee 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -113,7 +113,6 @@ _dl_signal_error (int errcode, const char *objname, const char *occation,
 			 : ""));
     }
 }
-INTDEF (_dl_signal_error)
 
 
 void
@@ -123,8 +122,8 @@ _dl_signal_cerror (int errcode, const char *objname, const char *occation,
 {
   if (__builtin_expect (GLRO(dl_debug_mask)
 			& ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
-    INTUSE(_dl_debug_printf) ("%s: error: %s: %s (%s)\n", objname, occation,
-			      errstring, receiver ? "continued" : "fatal");
+    _dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
+		      errstring, receiver ? "continued" : "fatal");
 
   if (receiver)
     {
@@ -134,7 +133,7 @@ _dl_signal_cerror (int errcode, const char *objname, const char *occation,
       (*receiver) (errcode, objname, errstring);
     }
   else
-    INTUSE(_dl_signal_error) (errcode, objname, occation, errstring);
+    _dl_signal_error (errcode, objname, occation, errstring);
 }
 
 
@@ -172,7 +171,6 @@ _dl_catch_error (const char **objname, const char **errstring,
   *errstring = c.errstring;
   return errcode == -1 ? 0 : errcode;
 }
-INTDEF (_dl_catch_error)
 
 
 void
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index 3dc1db16c9..a56722f6ce 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -147,9 +147,8 @@ _dl_fini (void)
 
 	  /* When debugging print a message first.  */
 	  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-	    INTUSE(_dl_debug_printf) ("\ncalling fini: %s\n\n",
-				      l->l_name[0]
-				      ? l->l_name : rtld_progname);
+	    _dl_debug_printf ("\ncalling fini: %s\n\n",
+			      l->l_name[0] ? l->l_name : rtld_progname);
 
 	  /* First see whether an array is given.  */
 	  if (l->l_info[DT_FINI_ARRAY] != NULL)
@@ -176,12 +175,12 @@ _dl_fini (void)
 
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
     {
-      INTUSE(_dl_debug_printf) ("\nruntime linker statistics:\n");
-      INTUSE(_dl_debug_printf) ("\
+      _dl_debug_printf ("\nruntime linker statistics:\n");
+      _dl_debug_printf ("\
            final number of relocations: %lu\n",
-				GL(dl_num_relocations));
-      INTUSE(_dl_debug_printf) ("\
+			GL(dl_num_relocations));
+      _dl_debug_printf ("\
 final number of relocations from cache: %lu\n",
-				GL(dl_num_cache_relocations));
+			GL(dl_num_cache_relocations));
     }
 }
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 37d5045d03..c06c71bbeb 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -52,8 +52,8 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
 
   /* Print a debug message if wanted.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-    INTUSE(_dl_debug_printf) ("\ncalling init: %s\n\n",
-			      l->l_name[0] ? l->l_name : rtld_progname);
+    _dl_debug_printf ("\ncalling init: %s\n\n",
+		      l->l_name[0] ? l->l_name : rtld_progname);
 
   /* Now run the local constructors.  There are two forms of them:
      - the one named by DT_INIT
@@ -109,9 +109,9 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
       unsigned int cnt;
 
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-	INTUSE(_dl_debug_printf) ("\ncalling preinit: %s\n\n",
-				  main_map->l_name[0]
-				  ? main_map->l_name : rtld_progname);
+	_dl_debug_printf ("\ncalling preinit: %s\n\n",
+			  main_map->l_name[0]
+			  ? main_map->l_name : rtld_progname);
 
       addrs = (ElfW(Addr) *) (preinit_array->d_un.d_ptr + main_map->l_addr);
       for (cnt = 0; cnt < i; ++cnt)
@@ -123,7 +123,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
      not been used before.  */
   r = _dl_debug_initialize (0);
   r->r_state = RT_ADD;
-  INTUSE(_dl_debug_state) ();
+  _dl_debug_state ();
 
   /* Stupid users forced the ELF specification to be changed.  It now
      says that the dynamic loader is responsible for determining the
@@ -141,7 +141,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
 
   /* Notify the debugger all new objects are now ready to go.  */
   r->r_state = RT_CONSISTENT;
-  INTUSE(_dl_debug_state) ();
+  _dl_debug_state ();
 
   /* Finished starting up.  */
   INTUSE(_dl_starting_up) = 0;
diff --git a/elf/dl-libc.c b/elf/dl-libc.c
index 557d2c3241..2b8cb0e15d 100644
--- a/elf/dl-libc.c
+++ b/elf/dl-libc.c
@@ -1,5 +1,5 @@
 /* Handle loading and unloading shared objects for internal libc purposes.
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Zack Weinberg <zack@rabi.columbia.edu>, 1999.
 
@@ -39,7 +39,7 @@ dlerror_run (void (*operate) (void *), void *args)
   const char *last_errstring = NULL;
   int result;
 
-  (void) _dl_catch_error (&objname, &last_errstring, operate, args);
+  (void) GLRO(dl_catch_error) (&objname, &last_errstring, operate, args);
 
   result = last_errstring != NULL;
   if (result && last_errstring != _dl_out_of_memory)
@@ -85,9 +85,9 @@ do_dlsym (void *ptr)
 {
   struct do_dlsym_args *args = (struct do_dlsym_args *) ptr;
   args->ref = NULL;
-  args->loadbase = _dl_lookup_symbol (args->name, args->map, &args->ref,
-				      args->map->l_local_scope, 0,
-				      DL_LOOKUP_RETURN_NEWEST);
+  args->loadbase = GLRO(dl_lookup_symbol) (args->name, args->map, &args->ref,
+					   args->map->l_local_scope, 0,
+					   DL_LOOKUP_RETURN_NEWEST);
 }
 
 static void
@@ -126,9 +126,9 @@ do_dlsym_private (void *ptr)
 
   struct do_dlsym_args *args = (struct do_dlsym_args *) ptr;
   args->ref = NULL;
-  l = _dl_lookup_versioned_symbol (args->name, args->map,
-				   &args->ref, args->map->l_scope,
-				   &vers, 0, 0);
+  l = GLRO(dl_lookup_versioned_symbol) (args->name, args->map,
+					&args->ref, args->map->l_scope,
+					&vers, 0, 0);
   args->loadbase = l;
 }
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f7449bce9c..1ff12836ec 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -220,7 +220,6 @@ _dl_dst_count (const char *name, int is_path)
 
   return cnt;
 }
-INTDEF (_dl_dst_count)
 
 
 char *
@@ -283,7 +282,6 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
 
   return result;
 }
-INTDEF (_dl_dst_substitute)
 
 
 /* Return copy of argument with all recognized dynamic string tokens
@@ -317,7 +315,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s)
   if (result == NULL)
     return NULL;
 
-  return INTUSE(_dl_dst_substitute) (l, s, result, 1);
+  return _dl_dst_substitute (l, s, result, 1);
 }
 
 
@@ -343,8 +341,7 @@ add_name_to_object (struct link_map *l, const char *name)
   if (newname == NULL)
     {
       /* No more memory.  */
-      INTUSE(_dl_signal_error) (ENOMEM, name, NULL,
-			     N_("cannot allocate name record"));
+      _dl_signal_error (ENOMEM, name, NULL, N_("cannot allocate name record"));
       return;
     }
   /* The object should have a libname set from _dl_new_object.  */
@@ -445,8 +442,8 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
 	    malloc (sizeof (*dirp) + ncapstr * sizeof (enum r_dir_status)
 		    + where_len + len + 1);
 	  if (dirp == NULL)
-	    INTUSE(_dl_signal_error) (ENOMEM, NULL, NULL,
-				      N_("cannot create cache for search path"));
+	    _dl_signal_error (ENOMEM, NULL, NULL,
+			      N_("cannot create cache for search path"));
 
 	  dirp->dirname = ((char *) dirp + sizeof (*dirp)
 			   + ncapstr * sizeof (enum r_dir_status));
@@ -527,7 +524,7 @@ decompose_rpath (struct r_search_path_struct *sps,
 		signal_error_cache:
 		  errstring = N_("cannot create cache for search path");
 		signal_error:
-		  INTUSE(_dl_signal_error) (ENOMEM, NULL, NULL, errstring);
+		  _dl_signal_error (ENOMEM, NULL, NULL, errstring);
 		}
 
 	      sps->dirs = result;
@@ -633,7 +630,7 @@ _dl_init_paths (const char *llp)
     {
       errstring = N_("cannot create search path array");
     signal_error:
-      INTUSE(_dl_signal_error) (ENOMEM, NULL, NULL, errstring);
+      _dl_signal_error (ENOMEM, NULL, NULL, errstring);
     }
 
   round_size = ((2 * sizeof (struct r_search_path_elem) - 1
@@ -786,7 +783,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
       free (l);
     }
   free (realname);
-  INTUSE(_dl_signal_error) (code, name, NULL, msg);
+  _dl_signal_error (code, name, NULL, msg);
 }
 
 
@@ -845,7 +842,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
 
   /* Print debugging message.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-    INTUSE(_dl_debug_printf) ("file=%s;  generating link map\n", name);
+    _dl_debug_printf ("file=%s;  generating link map\n", name);
 
   /* This is the ELF header.  We read it in `open_verify'.  */
   header = (void *) fbp->buf;
@@ -858,8 +855,8 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
       if (_dl_zerofd == -1)
 	{
 	  __close (fd);
-	  INTUSE(_dl_signal_error) (errno, NULL, NULL,
-				 N_("cannot open zero fill device"));
+	  _dl_signal_error (errno, NULL, NULL,
+			    N_("cannot open zero fill device"));
 	}
     }
 #endif
@@ -1260,7 +1257,7 @@ cannot allocate TLS data structures for initial thread");
   l->l_entry += l->l_addr;
 
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-    INTUSE(_dl_debug_printf) ("\
+    _dl_debug_printf ("\
   dynamic: 0x%0*lx  base: 0x%0*lx   size: 0x%0*Zx\n\
     entry: 0x%0*lx  phdr: 0x%0*lx  phnum:   %*u\n\n",
 			   (int) sizeof (void *) * 2,
@@ -1367,7 +1364,7 @@ print_search_path (struct r_search_path_elem **list,
   char buf[max_dirnamelen + max_capstrlen];
   int first = 1;
 
-  INTUSE(_dl_debug_printf) (" search path=");
+  _dl_debug_printf (" search path=");
 
   while (*list != NULL && (*list)->what == what) /* Yes, ==.  */
     {
@@ -1638,7 +1635,7 @@ open_path (const char *name, size_t namelen, int preloaded,
 
 	  /* Print name we try if this is wanted.  */
 	  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
-	    INTUSE(_dl_debug_printf) ("  trying file=%s\n", buf);
+	    _dl_debug_printf ("  trying file=%s\n", buf);
 
 	  fd = open_verify (buf, fbp);
 	  if (this_dir->status[cnt] == unknown)
@@ -1772,7 +1769,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
   /* Display information if we are debugging.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
       && loader != NULL)
-    INTUSE(_dl_debug_printf) ("\nfile=%s;  needed by %s\n", name,
+    _dl_debug_printf ("\nfile=%s;  needed by %s\n", name,
 			      loader->l_name[0]
 			      ? loader->l_name : rtld_progname);
 
@@ -1783,7 +1780,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
       size_t namelen = strlen (name) + 1;
 
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
-	INTUSE(_dl_debug_printf) ("find library=%s; searching\n", name);
+	_dl_debug_printf ("find library=%s; searching\n", name);
 
       fd = -1;
 
@@ -1888,7 +1885,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 
       /* Add another newline when we are tracing the library loading.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
-        INTUSE(_dl_debug_printf) ("\n");
+        _dl_debug_printf ("\n");
     }
   else
     {
@@ -1920,8 +1917,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
 	  /* Enter the new object in the list of loaded objects.  */
 	  if ((name_copy = local_strdup (name)) == NULL
 	      || (l = _dl_new_object (name_copy, name, type, loader)) == NULL)
-	    INTUSE(_dl_signal_error) (ENOMEM, name, NULL, N_("\
-cannot create shared object descriptor"));
+	    _dl_signal_error (ENOMEM, name, NULL,
+			      N_("cannot create shared object descriptor"));
 	  /* Signal that this is a faked entry.  */
 	  l->l_faked = 1;
 	  /* Since the descriptor is initialized with zero we do not
@@ -1934,15 +1931,15 @@ cannot create shared object descriptor"));
 	  return l;
 	}
       else
-	INTUSE(_dl_signal_error) (errno, name, NULL,
-				  N_("cannot open shared object file"));
+	_dl_signal_error (errno, name, NULL,
+			  N_("cannot open shared object file"));
     }
 
   void *stack_end = __libc_stack_end;
   return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode,
 				 &stack_end);
 }
-INTDEF (_dl_map_object)
+
 
 void
 internal_function
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index f4ebd93fc3..925f01c102 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -191,11 +191,11 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
 
       /* Display information if we are debugging.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-	INTUSE(_dl_debug_printf) ("\
+	_dl_debug_printf ("\
 \nfile=%s;  needed by %s (relocation dependency)\n\n",
-				  map->l_name[0] ? map->l_name : rtld_progname,
-				  undef_map->l_name[0]
-				  ? undef_map->l_name : rtld_progname);
+			  map->l_name[0] ? map->l_name : rtld_progname,
+			  undef_map->l_name[0]
+			  ? undef_map->l_name : rtld_progname);
     }
   else
     /* Whoa, that was bad luck.  We have to search again.  */
@@ -312,8 +312,8 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
       && add_dependency (undef_map, current_value.m) < 0)
       /* Something went wrong.  Perhaps the object we tried to reference
 	 was just removed.  Try finding another definition.  */
-      return INTUSE(_dl_lookup_symbol) (undef_name, undef_map, ref,
-					symbol_scope, type_class, flags);
+      return _dl_lookup_symbol (undef_name, undef_map, ref, symbol_scope,
+				type_class, flags);
 
   if (__builtin_expect (GLRO(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
@@ -323,7 +323,6 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
   *ref = current_value.s;
   return LOOKUP_VALUE (current_value.m);
 }
-INTDEF (_dl_lookup_symbol)
 
 
 /* This function is nearly the same as `_dl_lookup_symbol' but it
@@ -400,8 +399,7 @@ _dl_lookup_symbol_skip (const char *undef_name,
 
 
 /* This function works like _dl_lookup_symbol but it takes an
-   additional arguement with the version number of the requested
-   symbol.
+   additional argument with the version number of the requested symbol.
 
    XXX We'll see whether we need this separate function.  */
 lookup_t
@@ -518,9 +516,9 @@ _dl_lookup_versioned_symbol (const char *undef_name,
       && add_dependency (undef_map, current_value.m) < 0)
       /* Something went wrong.  Perhaps the object we tried to reference
 	 was just removed.  Try finding another definition.  */
-      return INTUSE(_dl_lookup_versioned_symbol) (undef_name, undef_map,
-						  ref, symbol_scope,
-						  version, type_class, flags);
+      return _dl_lookup_versioned_symbol (undef_name, undef_map, ref,
+					  symbol_scope, version, type_class,
+					  flags);
 
   if (__builtin_expect (GLRO(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
@@ -530,7 +528,6 @@ _dl_lookup_versioned_symbol (const char *undef_name,
   *ref = current_value.s;
   return LOOKUP_VALUE (current_value.m);
 }
-INTDEF (_dl_lookup_versioned_symbol)
 
 
 /* Similar to _dl_lookup_symbol_skip but takes an additional argument
@@ -652,14 +649,12 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
 
   if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
     {
-      INTUSE(_dl_debug_printf) ("binding file %s to %s: %s symbol `%s'",
-				(reference_name[0]
-				 ? reference_name
-				 : (rtld_progname ?: "<main program>")),
-				value->m->l_name[0]
-				? value->m->l_name : rtld_progname,
-				protected ? "protected" : "normal",
-				undef_name);
+      _dl_debug_printf ("binding file %s to %s: %s symbol `%s'",
+			(reference_name[0]
+			 ? reference_name
+			 : (rtld_progname ?: "<main program>")),
+			value->m->l_name[0] ? value->m->l_name : rtld_progname,
+			protected ? "protected" : "normal", undef_name);
       if (version)
 	_dl_debug_printf_c (" [%s]\n", version->name);
       else
diff --git a/elf/dl-misc.c b/elf/dl-misc.c
index 9b29bcf4cd..abc5cbb853 100644
--- a/elf/dl-misc.c
+++ b/elf/dl-misc.c
@@ -279,7 +279,6 @@ _dl_debug_printf (const char *fmt, ...)
   _dl_debug_vdprintf (GLRO(dl_debug_fd), 1, fmt, arg);
   va_end (arg);
 }
-INTDEF(_dl_debug_printf)
 
 
 /* Write to debug file but don't start with a tag.  */
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 09687d8940..ce9a959ea7 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -111,8 +111,8 @@ add_to_global (struct link_map *new)
 	{
 	  GL(dl_global_scope_alloc) = 0;
 	nomem:
-	  _dl_signal_error (ENOMEM, new->l_libname->name, NULL,
-			    N_("cannot extend global scope"));
+	  GLRO(dl_signal_error) (ENOMEM, new->l_libname->name, NULL,
+				 N_("cannot extend global scope"));
 	  return 1;
 	}
 
@@ -235,7 +235,7 @@ dl_open_worker (void *a)
 #ifdef SHARED
   /* Check whether _dl_open() has been called from a valid DSO.  */
   if (check_libc_caller (args->caller_dl_open) != 0)
-    _dl_signal_error (0, "dlopen", NULL, N_("invalid caller"));
+    GLRO(dl_signal_error) (0, "dlopen", NULL, N_("invalid caller"));
 #endif
 
   /* Maybe we have to expand a DST.  */
@@ -251,8 +251,8 @@ dl_open_worker (void *a)
       /* DSTs must not appear in SUID/SGID programs.  */
       if (__libc_enable_secure)
 	/* This is an error.  */
-	_dl_signal_error (0, "dlopen", NULL,
-			  N_("DST not allowed in SUID/SGID programs"));
+	GLRO(dl_signal_error) (0, "dlopen", NULL,
+			       N_("DST not allowed in SUID/SGID programs"));
 
       /* We have to find out from which object the caller is calling.  */
       call_map = NULL;
@@ -282,15 +282,15 @@ dl_open_worker (void *a)
 
       /* If the substitution failed don't try to load.  */
       if (*new_file == '\0')
-	_dl_signal_error (0, "dlopen", NULL,
-			  N_("empty dynamic string token substitution"));
+	GLRO(dl_signal_error) (0, "dlopen", NULL,
+			       N_("empty dynamic string token substitution"));
 
       /* Now we have a new file name.  */
       file = new_file;
     }
 
   /* Load the named object.  */
-  args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0, mode);
+  args->map = new = GLRO(dl_map_object) (NULL, file, 0, lt_loaded, 0, mode);
 
   /* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
      set and the object is not already loaded.  */
@@ -309,8 +309,8 @@ dl_open_worker (void *a)
     {
       /* Let the user know about the opencount.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-	_dl_debug_printf ("opening file=%s; opencount == %u\n\n",
-			  new->l_name, new->l_opencount);
+	GLRO(dl_debug_printf) ("opening file=%s; opencount == %u\n\n",
+			       new->l_name, new->l_opencount);
 
       /* If the user requested the object to be in the global namespace
 	 but it is not so far, add it now.  */
@@ -324,12 +324,12 @@ dl_open_worker (void *a)
     }
 
   /* Load that object's dependencies.  */
-  _dl_map_object_deps (new, NULL, 0, 0, mode & __RTLD_DLOPEN);
+  GLRO(dl_map_object_deps) (new, NULL, 0, 0, mode & __RTLD_DLOPEN);
 
   /* So far, so good.  Now check the versions.  */
   for (i = 0; i < new->l_searchlist.r_nlist; ++i)
     if (new->l_searchlist.r_list[i]->l_versions == NULL)
-      (void) _dl_check_map_versions (new->l_searchlist.r_list[i], 0, 0);
+      (void) GLRO(dl_check_map_versions) (new->l_searchlist.r_list[i], 0, 0);
 
 #ifdef SCOPE_DEBUG
   show_scope (new);
@@ -358,16 +358,16 @@ dl_open_worker (void *a)
 		 start the profiling.  */
 	      struct link_map *old_profile_map = GL(dl_profile_map);
 
-	      _dl_relocate_object (l, l->l_scope, 1, 1);
+	      GLRO(dl_relocate_object) (l, l->l_scope, 1, 1);
 
 	      if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
 		/* We must prepare the profiling.  */
-		_dl_start_profile (GL(dl_profile_map),
-				   GLRO(dl_profile_output));
+		GLRO(dl_start_profile) (GL(dl_profile_map),
+					GLRO(dl_profile_output));
 	    }
 	  else
 #endif
-	    _dl_relocate_object (l, l->l_scope, lazy, 0);
+	    GLRO(dl_relocate_object) (l, l->l_scope, lazy, 0);
 	}
 
       if (l == new)
@@ -430,8 +430,8 @@ dl_open_worker (void *a)
 		newp = (struct r_scope_elem **)
 		  malloc (new_size * sizeof (struct r_scope_elem *));
 		if (newp == NULL)
-		  _dl_signal_error (ENOMEM, "dlopen", NULL,
-				    N_("cannot create scope list"));
+		  GLRO(dl_signal_error) (ENOMEM, "dlopen", NULL,
+					 N_("cannot create scope list"));
 		imap->l_scope = memcpy (newp, imap->l_scope,
 					cnt * sizeof (imap->l_scope[0]));
 	      }
@@ -441,8 +441,8 @@ dl_open_worker (void *a)
 		  realloc (imap->l_scope,
 			   new_size * sizeof (struct r_scope_elem *));
 		if (newp == NULL)
-		  _dl_signal_error (ENOMEM, "dlopen", NULL,
-				    N_("cannot create scope list"));
+		  GLRO(dl_signal_error) (ENOMEM, "dlopen", NULL,
+					 N_("cannot create scope list"));
 		imap->l_scope = newp;
 	      }
 
@@ -503,8 +503,8 @@ dl_open_worker (void *a)
 		   generation.  */
 		++GL(dl_tls_generation);
 
-		_dl_signal_error (ENOMEM, "dlopen", NULL,
-				  N_("cannot create TLS data structures"));
+		GLRO(dl_signal_error) (ENOMEM, "dlopen", NULL, N_("\
+cannot create TLS data structures"));
 	      }
 
 	    listp->len = TLS_SLOTINFO_SURPLUS;
@@ -528,7 +528,7 @@ dl_open_worker (void *a)
 #endif
 
   /* Run the initializer functions of new objects.  */
-  _dl_init (new, __libc_argc, __libc_argv, __environ);
+  GLRO(dl_init) (new, __libc_argc, __libc_argv, __environ);
 
   /* Now we can make the new map available in the global scope.  */
   if (mode & RTLD_GLOBAL)
@@ -550,8 +550,8 @@ dl_open_worker (void *a)
 
   /* Let the user know about the opencount.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
-    _dl_debug_printf ("opening file=%s; opencount == %u\n\n",
-		      new->l_name, new->l_opencount);
+    GLRO(dl_debug_printf) ("opening file=%s; opencount == %u\n\n",
+			   new->l_name, new->l_opencount);
 }
 
 
@@ -566,7 +566,8 @@ _dl_open (const char *file, int mode, const void *caller_dlopen)
 
   if ((mode & RTLD_BINDING_MASK) == 0)
     /* One of the flags must be set.  */
-    _dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()"));
+    GLRO(dl_signal_error) (EINVAL, file, NULL,
+			   N_("invalid mode for dlopen()"));
 
   /* Make sure we are alone.  */
   __rtld_lock_lock_recursive (GL(dl_load_lock));
@@ -576,11 +577,11 @@ _dl_open (const char *file, int mode, const void *caller_dlopen)
   args.caller_dlopen = caller_dlopen;
   args.caller_dl_open = RETURN_ADDRESS (0);
   args.map = NULL;
-  errcode = _dl_catch_error (&objname, &errstring, dl_open_worker, &args);
+  errcode = GLRO(dl_catch_error) (&objname, &errstring, dl_open_worker, &args);
 
 #ifndef MAP_COPY
   /* We must munmap() the cache file.  */
-  _dl_unload_cache ();
+  GLRO(dl_unload_cache) ();
 #endif
 
   /* Release the lock.  */
@@ -636,7 +637,7 @@ _dl_open (const char *file, int mode, const void *caller_dlopen)
 	free ((char *) errstring);
 
       /* Reraise the error.  */
-      _dl_signal_error (errcode, objname, NULL, local_errstring);
+      GLRO(dl_signal_error) (errcode, objname, NULL, local_errstring);
     }
 
 #ifndef SHARED
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 164ae98f99..3b99fad8ea 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -450,7 +450,6 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
   /* Turn on profiling.  */
   running = 1;
 }
-INTDEF (_dl_start_profile)
 
 
 void
diff --git a/elf/dl-profstub.c b/elf/dl-profstub.c
index c8184b9aad..ad0f003abd 100644
--- a/elf/dl-profstub.c
+++ b/elf/dl-profstub.c
@@ -1,5 +1,5 @@
 /* Helper definitions for profiling of shared libraries.
-   Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -24,13 +24,12 @@
 
 /* This is the map for the shared object we profile.  It is defined here
    only because we test for this value being NULL or not.  */
-//Xextern struct link_map *_dl_profile_map;
 
 
 void
 _dl_mcount_wrapper (void *selfpc)
 {
-  _dl_mcount ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc);
+  GLRO(dl_mcount) ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc);
 }
 
 
@@ -38,6 +37,6 @@ void
 _dl_mcount_wrapper_check (void *selfpc)
 {
   if (GL(dl_profile_map) != NULL)
-    _dl_mcount ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc);
+    GLRO(dl_mcount) ((ElfW(Addr)) RETURN_ADDRESS (0), (ElfW(Addr)) selfpc);
 }
 libc_hidden_def (_dl_mcount_wrapper_check)
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index dab5dea13b..4349dc27fb 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -54,7 +54,7 @@ _dl_allocate_static_tls (struct link_map *map)
   if (map->l_tls_align > GL(dl_tls_static_align))
     {
     fail:
-      INTUSE(_dl_signal_error) (0, map->l_name, NULL, N_("\
+      _dl_signal_error (0, map->l_name, NULL, N_("\
 cannot allocate memory in static TLS block"));
     }
 
@@ -147,9 +147,9 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
     lazy = 0;
 
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
-    INTUSE(_dl_debug_printf) ("\nrelocation processing: %s%s\n",
-			      l->l_name[0] ? l->l_name : rtld_progname,
-			      lazy ? " (lazy)" : "");
+    _dl_debug_printf ("\nrelocation processing: %s%s\n",
+		      l->l_name[0] ? l->l_name : rtld_progname,
+		      lazy ? " (lazy)" : "");
 
   /* DT_TEXTREL is now in level 2 and might phase out at some time.
      But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
@@ -175,7 +175,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 	      {
 		errstring = N_("cannot make segment writable for relocation");
 	      call_error:
-		INTUSE(_dl_signal_error) (errno, l->l_name, NULL, errstring);
+		_dl_signal_error (errno, l->l_name, NULL, errstring);
 	      }
 
 #if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7
@@ -214,13 +214,12 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 	     l->l_lookup_cache.type_class = _tc;			      \
 	     l->l_lookup_cache.sym = (*ref);				      \
 	     _lr = ((version) != NULL && (version)->hash != 0		      \
-		    ? INTUSE(_dl_lookup_versioned_symbol) (strtab	      \
-							   + (*ref)->st_name, \
-							   l, (ref), scope,   \
-							   (version), _tc, 0) \
-		    : INTUSE(_dl_lookup_symbol) (strtab + (*ref)->st_name, l, \
-					         (ref), scope, _tc,	      \
-						 DL_LOOKUP_ADD_DEPENDENCY));  \
+		    ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name,  \
+						   l, (ref), scope, (version),\
+						   _tc, 0)		      \
+		    : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref),  \
+					 scope, _tc,			      \
+					 DL_LOOKUP_ADD_DEPENDENCY));	      \
 	     l->l_lookup_cache.ret = (*ref);				      \
 	     l->l_lookup_cache.value = _lr; }))				      \
      : l)
@@ -236,13 +235,12 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 	     l->l_lookup_cache.type_class = _tc;			      \
 	     l->l_lookup_cache.sym = (*ref);				      \
 	     _lr = ((version) != NULL && (version)->hash != 0		      \
-		    ? INTUSE(_dl_lookup_versioned_symbol) (strtab	      \
-							   + (*ref)->st_name, \
-							   l, (ref), scope,   \
-							   (version), _tc, 0) \
-		    : INTUSE(_dl_lookup_symbol) (strtab + (*ref)->st_name, l, \
-					      	 (ref), scope, _tc,	      \
-						 DL_LOOKUP_ADD_DEPENDENCY));  \
+		    ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name,  \
+						   l, (ref), scope,	      \
+						   (version), _tc, 0)	      \
+		    : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref),  \
+					 scope, _tc,			      \
+					 DL_LOOKUP_ADD_DEPENDENCY));	      \
 	     l->l_lookup_cache.ret = (*ref);				      \
 	     l->l_lookup_cache.value = _lr; }))				      \
      : l->l_addr)
@@ -313,7 +311,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
   if (l->l_relro_size != 0)
     _dl_protect_relro (l);
 }
-INTDEF (_dl_relocate_object)
+
 
 void internal_function
 _dl_protect_relro (struct link_map *l)
@@ -326,9 +324,9 @@ _dl_protect_relro (struct link_map *l)
   if (start != end
       && __mprotect ((void *) start, end - start, PROT_READ) < 0)
     {
-      const char *errstring = N_("\
+      static const char errstring[] = N_("\
 cannot apply additional memory protection after relocation");
-      INTUSE(_dl_signal_error) (errno, l->l_name, NULL, errstring);
+      _dl_signal_error (errno, l->l_name, NULL, errstring);
     }
 }
 
@@ -365,5 +363,5 @@ _dl_reloc_bad_type (struct link_map *map, unsigned int type, int plt)
   *cp++ = DIGIT (type);
   *cp = '\0';
 
-  INTUSE(_dl_signal_error) (0, map->l_name, NULL, msgbuf);
+  _dl_signal_error (0, map->l_name, NULL, msgbuf);
 }
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index b71dee5e75..f89cc68de2 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -84,19 +84,17 @@ fixup (
 
 	    if (version->hash != 0)
 	      {
-		result = INTUSE(_dl_lookup_versioned_symbol) (strtab
-							      + sym->st_name,
-							      l, &sym, l->l_scope,
-							      version,
-							      ELF_RTYPE_CLASS_PLT,
-							      0);
+		result = _dl_lookup_versioned_symbol (strtab + sym->st_name,
+						      l, &sym, l->l_scope,
+						      version,
+						      ELF_RTYPE_CLASS_PLT, 0);
 		break;
 	      }
 	  }
 	case 0:
-	  result = INTUSE(_dl_lookup_symbol) (strtab + sym->st_name, l, &sym,
-					      l->l_scope, ELF_RTYPE_CLASS_PLT,
-					      DL_LOOKUP_ADD_DEPENDENCY);
+	  result = _dl_lookup_symbol (strtab + sym->st_name, l, &sym,
+				      l->l_scope, ELF_RTYPE_CLASS_PLT,
+				      DL_LOOKUP_ADD_DEPENDENCY);
 	}
 
       /* Currently result contains the base load address (or link map)
@@ -174,21 +172,19 @@ profile_fixup (
 
 		if (version->hash != 0)
 		  {
-		    result = INTUSE(_dl_lookup_versioned_symbol) (strtab
-								  + sym->st_name,
-								  l, &sym,
-								  l->l_scope,
-								  version,
-								  ELF_RTYPE_CLASS_PLT,
-								  0);
+		    result = _dl_lookup_versioned_symbol (strtab
+							  + sym->st_name,
+							  l, &sym, l->l_scope,
+							  version,
+							  ELF_RTYPE_CLASS_PLT,
+							  0);
 		    break;
 		  }
 	      }
 	    case 0:
-	      result = INTUSE(_dl_lookup_symbol) (strtab + sym->st_name, l,
-						  &sym, l->l_scope,
-						  ELF_RTYPE_CLASS_PLT,
-						  DL_LOOKUP_ADD_DEPENDENCY);
+	      result = _dl_lookup_symbol (strtab + sym->st_name, l, &sym,
+					  l->l_scope, ELF_RTYPE_CLASS_PLT,
+					  DL_LOOKUP_ADD_DEPENDENCY);
 	    }
 
 	  /* Currently result contains the base load address (or link map)
diff --git a/elf/dl-sym.c b/elf/dl-sym.c
index 851d6b518e..bee49f1fda 100644
--- a/elf/dl-sym.c
+++ b/elf/dl-sym.c
@@ -24,6 +24,37 @@
 #include <dlfcn.h>
 #include <ldsodefs.h>
 #include <dl-hash.h>
+#include <dl-tls.h>
+
+
+#if defined USE_TLS && defined SHARED
+/* Systems which do not have tls_index also probably have to define
+   DONT_USE_TLS_INDEX.  */
+
+# ifndef __TLS_GET_ADDR
+#  define __TLS_GET_ADDR __tls_get_addr
+# endif
+
+/* Return the symbol address given the map of the module it is in and
+   the symbol record.  This is used in dl-sym.c.  */
+static void *
+internal_function
+_dl_tls_symaddr (struct link_map *map, const ElfW(Sym) *ref)
+{
+# ifndef DONT_USE_TLS_INDEX
+  tls_index tmp =
+    {
+      .ti_module = map->l_tls_modid,
+      .ti_offset = ref->st_value
+    };
+
+  return __TLS_GET_ADDR (&tmp);
+# else
+  return __TLS_GET_ADDR (map->l_tls_modid, ref->st_value);
+# endif
+}
+#endif
+
 
 void *
 internal_function
@@ -51,9 +82,9 @@ _dl_sym (void *handle, const char *name, void *who)
 
   if (handle == RTLD_DEFAULT)
     /* Search the global scope as seen in the caller object.  */
-    result = _dl_lookup_symbol (name, match, &ref, match->l_scope, 0,
-				DL_LOOKUP_RETURN_NEWEST
-				| DL_LOOKUP_ADD_DEPENDENCY);
+    result = GLRO(dl_lookup_symbol) (name, match, &ref, match->l_scope, 0,
+				     DL_LOOKUP_RETURN_NEWEST
+				     | DL_LOOKUP_ADD_DEPENDENCY);
   else
     {
       if (handle != RTLD_NEXT)
@@ -61,8 +92,9 @@ _dl_sym (void *handle, const char *name, void *who)
 	  /* Search the scope of the given object.  */
 	  struct link_map *map = handle;
 
-	  result = _dl_lookup_symbol (name, match, &ref, map->l_local_scope,
-				      0, DL_LOOKUP_RETURN_NEWEST);
+	  result = GLRO(dl_lookup_symbol) (name, match, &ref,
+					   map->l_local_scope, 0,
+					   DL_LOOKUP_RETURN_NEWEST);
 	}
       else
 	{
@@ -71,7 +103,7 @@ _dl_sym (void *handle, const char *name, void *who)
 	      if (! GL(dl_loaded)
 		  || caller < GL(dl_loaded)->l_map_start
 		  || caller >= GL(dl_loaded)->l_map_end)
-	        _dl_signal_error (0, NULL, NULL, N_("\
+	        GLRO(dl_signal_error) (0, NULL, NULL, N_("\
 RTLD_NEXT used in code not dynamically loaded"));
 	    }
 
@@ -79,8 +111,8 @@ RTLD_NEXT used in code not dynamically loaded"));
 	  while (l->l_loader != NULL)
 	    l = l->l_loader;
 
-	  result = _dl_lookup_symbol_skip (name, l, &ref, l->l_local_scope,
-					   match);
+	  result = GLRO(dl_lookup_symbol_skip) (name, l, &ref,
+						l->l_local_scope, match);
 	}
     }
 
@@ -133,8 +165,9 @@ _dl_vsym (void *handle, const char *name, const char *version, void *who)
 
   if (handle == RTLD_DEFAULT)
     /* Search the global scope.  */
-    result = _dl_lookup_versioned_symbol (name, match, &ref, match->l_scope,
-					  &vers, 0, DL_LOOKUP_ADD_DEPENDENCY);
+    result = GLRO(dl_lookup_versioned_symbol) (name, match, &ref,
+					       match->l_scope, &vers, 0,
+					       DL_LOOKUP_ADD_DEPENDENCY);
   else if (handle == RTLD_NEXT)
     {
       if (__builtin_expect (match == GL(dl_loaded), 0))
@@ -142,7 +175,7 @@ _dl_vsym (void *handle, const char *name, const char *version, void *who)
 	  if (! GL(dl_loaded)
 	      || caller < GL(dl_loaded)->l_map_start
 	      || caller >= GL(dl_loaded)->l_map_end)
-	    _dl_signal_error (0, NULL, NULL, N_("\
+	    GLRO(dl_signal_error) (0, NULL, NULL, N_("\
 RTLD_NEXT used in code not dynamically loaded"));
 	}
 
@@ -150,16 +183,17 @@ RTLD_NEXT used in code not dynamically loaded"));
       while (l->l_loader != NULL)
 	l = l->l_loader;
 
-      result = _dl_lookup_versioned_symbol_skip (name, l, &ref,
-						 l->l_local_scope,
-						 &vers, match);
+      result = GLRO(dl_lookup_versioned_symbol_skip) (name, l, &ref,
+						      l->l_local_scope,
+						      &vers, match);
     }
   else
     {
       /* Search the scope of the given object.  */
       struct link_map *map = handle;
-      result = _dl_lookup_versioned_symbol (name, map, &ref,
-					    map->l_local_scope, &vers, 0, 0);
+      result = GLRO(dl_lookup_versioned_symbol) (name, map, &ref,
+						 map->l_local_scope, &vers,
+						 0, 0);
     }
 
   if (ref != NULL)
diff --git a/elf/dl-version.c b/elf/dl-version.c
index 83d63f30de..9176aeb5ea 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -88,10 +88,10 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string,
 
   /* Display information about what we are doing while debugging.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0))
-    INTUSE(_dl_debug_printf) ("\
+    _dl_debug_printf ("\
 checking for version `%s' in file %s required by file %s\n",
-			      string, map->l_name[0]
-			      ? map->l_name : rtld_progname, name);
+		      string, map->l_name[0] ? map->l_name : rtld_progname,
+		      name);
 
   if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0))
     {
@@ -215,9 +215,8 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
 					  &buf[sizeof (buf) - 1], 10, 0),
 				   " of Verneed record\n");
 	call_error:
-	  INTUSE(_dl_signal_error) (errval, (*map->l_name
-					     ? map->l_name : rtld_progname),
-				    NULL, errstring);
+	  _dl_signal_error (errval, *map->l_name ? map->l_name : rtld_progname,
+			    NULL, errstring);
 	}
 
       while (1)
@@ -375,7 +374,6 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
 
   return result;
 }
-INTDEF (_dl_check_map_versions)
 
 
 int
@@ -387,7 +385,7 @@ _dl_check_all_versions (struct link_map *map, int verbose, int trace_mode)
 
   for (l = map; l != NULL; l = l->l_next)
     result |= (! l->l_faked
-	       && INTUSE(_dl_check_map_versions) (l, verbose, trace_mode));
+	       && _dl_check_map_versions (l, verbose, trace_mode));
 
   return result;
 }
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index 15900cdf99..014a06a5aa 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -61,9 +61,9 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref,
 
       /* Print some debugging info if wanted.  */
       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
-	INTUSE(_dl_debug_printf) ("symbol=%s;  lookup in file=%s\n",
-				  undef_name, (map->l_name[0]
-					       ? map->l_name : rtld_progname));
+	_dl_debug_printf ("symbol=%s;  lookup in file=%s\n",
+			  undef_name,
+			  map->l_name[0] ? map->l_name : rtld_progname);
 
       symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
       strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
diff --git a/elf/rtld.c b/elf/rtld.c
index c0e15a696c..cf82d5ad3b 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <dlfcn.h>
 #include <fcntl.h>
 #include <stdbool.h>
 #include <stdlib.h>
@@ -121,6 +122,27 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
     ._dl_hwcap_mask = HWCAP_IMPORTANT,
     ._dl_lazy = 1,
     ._dl_fpu_control = _FPU_DEFAULT,
+
+    /* Function pointers.  */
+    ._dl_get_origin = _dl_get_origin,
+    ._dl_dst_count = _dl_dst_count,
+    ._dl_dst_substitute = _dl_dst_substitute,
+    ._dl_map_object = _dl_map_object,
+    ._dl_map_object_deps = _dl_map_object_deps,
+    ._dl_relocate_object = _dl_relocate_object,
+    ._dl_check_map_versions = _dl_check_map_versions,
+    ._dl_init = _dl_init,
+    ._dl_debug_state = _dl_debug_state,
+    ._dl_unload_cache = _dl_unload_cache,
+    ._dl_debug_printf = _dl_debug_printf,
+    ._dl_catch_error = _dl_catch_error,
+    ._dl_signal_error = _dl_signal_error,
+    ._dl_start_profile = _dl_start_profile,
+    ._dl_mcount = _dl_mcount_internal,
+    ._dl_lookup_symbol = _dl_lookup_symbol,
+    ._dl_lookup_versioned_symbol = _dl_lookup_versioned_symbol,
+    ._dl_lookup_symbol_skip = _dl_lookup_symbol_skip,
+    ._dl_lookup_versioned_symbol_skip = _dl_lookup_versioned_symbol_skip,
   };
 /* If we would use strong_alias here the compiler would see a
    non-hidden definition.  This would undo the effect of the previous
@@ -551,16 +573,15 @@ relocate_doit (void *a)
 {
   struct relocate_args *args = (struct relocate_args *) a;
 
-  INTUSE(_dl_relocate_object) (args->l, args->l->l_scope, args->lazy, 0);
+  _dl_relocate_object (args->l, args->l->l_scope, args->lazy, 0);
 }
 
 static void
 map_doit (void *a)
 {
   struct map_args *args = (struct map_args *) a;
-  args->map = INTUSE(_dl_map_object) (args->loader, args->str,
-				      args->is_preloaded, lt_library, 0,
-				      args->mode);
+  args->map = _dl_map_object (args->loader, args->str,
+			      args->is_preloaded, lt_library, 0, args->mode);
 }
 
 static void
@@ -823,7 +844,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 	  args.loader = NULL;
 	  args.is_preloaded = 0;
 	  args.mode = __RTLD_OPENEXEC;
-	  (void) INTUSE(_dl_catch_error) (&objname, &err_str, map_doit, &args);
+	  (void) _dl_catch_error (&objname, &err_str, map_doit, &args);
 	  if (__builtin_expect (err_str != NULL, 0))
 	    /* We don't free the returned string, the programs stops
 	       anyway.  */
@@ -832,8 +853,8 @@ of this helper program; chances are you did not intend to run this program.\n\
       else
 	{
 	  HP_TIMING_NOW (start);
-	  INTUSE(_dl_map_object) (NULL, rtld_progname, 0, lt_library, 0,
-				  __RTLD_OPENEXEC);
+	  _dl_map_object (NULL, rtld_progname, 0, lt_library, 0,
+			  __RTLD_OPENEXEC);
 	  HP_TIMING_NOW (stop);
 
 	  HP_TIMING_DIFF (load_time, start, stop);
@@ -1094,10 +1115,8 @@ of this helper program; chances are you did not intend to run this program.\n\
 	    && (__builtin_expect (! INTUSE(__libc_enable_secure), 1)
 		|| strchr (p, '/') == NULL))
 	  {
-	    struct link_map *new_map = INTUSE(_dl_map_object) (GL(dl_loaded),
-							       p, 1,
-							       lt_library,
-							       0, 0);
+	    struct link_map *new_map = _dl_map_object (GL(dl_loaded), p, 1,
+						       lt_library, 0, 0);
 	    if (++new_map->l_opencount == 1)
 	      /* It is no duplicate.  */
 	      ++npreloads;
@@ -1174,8 +1193,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 		args.is_preloaded = 1;
 		args.mode = 0;
 
-		(void) INTUSE(_dl_catch_error) (&objname, &err_str, map_doit,
-						&args);
+		(void) _dl_catch_error (&objname, &err_str, map_doit, &args);
 		if (__builtin_expect (err_str != NULL, 0))
 		  {
 		    _dl_error_printf ("\
@@ -1193,9 +1211,8 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
       if (problem != NULL)
 	{
 	  char *p = strndupa (problem, file_size - (problem - file));
-	  struct link_map *new_map = INTUSE(_dl_map_object) (GL(dl_loaded), p,
-							     1, lt_library,
-							     0, 0);
+	  struct link_map *new_map = _dl_map_object (GL(dl_loaded), p, 1,
+						     lt_library, 0, 0);
 	  if (++new_map->l_opencount == 1)
 	    /* It is no duplicate.  */
 	    ++npreloads;
@@ -1294,8 +1311,7 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
      specified some libraries to load, these are inserted before the actual
      dependencies in the executable's searchlist for symbol resolution.  */
   HP_TIMING_NOW (start);
-  INTUSE(_dl_map_object_deps) (GL(dl_loaded), preloads, npreloads,
-			       mode == trace, 0);
+  _dl_map_object_deps (GL(dl_loaded), preloads, npreloads, mode == trace, 0);
   HP_TIMING_NOW (stop);
   HP_TIMING_DIFF (diff, start, stop);
   HP_TIMING_ACCUM_NT (load_time, diff);
@@ -1505,10 +1521,9 @@ cannot allocate TLS data structures for initial thread");
 	    ElfW(Addr) loadbase;
 	    lookup_t result;
 
-	    result = INTUSE(_dl_lookup_symbol) (INTUSE(_dl_argv)[i],
-						GL(dl_loaded),
-						&ref, GL(dl_loaded)->l_scope,
-						ELF_RTYPE_CLASS_PLT, 1);
+	    result = _dl_lookup_symbol (INTUSE(_dl_argv)[i], GL(dl_loaded),
+					&ref, GL(dl_loaded)->l_scope,
+					ELF_RTYPE_CLASS_PLT, 1);
 
 	    loadbase = LOOKUP_VALUE_ADDRESS (result);
 
@@ -1545,8 +1560,8 @@ cannot allocate TLS data structures for initial thread");
 
 	      if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
 		  && GL(dl_rtld_map).l_opencount > 1)
-		INTUSE(_dl_relocate_object) (&GL(dl_rtld_map),
-					     GL(dl_loaded)->l_scope, 0, 0);
+		_dl_relocate_object (&GL(dl_rtld_map), GL(dl_loaded)->l_scope,
+				     0, 0);
 	    }
 
 #define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
@@ -1783,8 +1798,8 @@ cannot allocate TLS data structures for initial thread");
 	    }
 
 	  if (l != &GL(dl_rtld_map))
-	    INTUSE(_dl_relocate_object) (l, l->l_scope, GLRO(dl_lazy),
-					 consider_profiling);
+	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy),
+				 consider_profiling);
 
 	  l = l->l_prev;
 	}
@@ -1806,16 +1821,14 @@ cannot allocate TLS data structures for initial thread");
 	 needs to have _dl_profile_map set up by the relocator.  */
       if (__builtin_expect (GL(dl_profile_map) != NULL, 0))
 	/* We must prepare the profiling.  */
-	INTUSE(_dl_start_profile) (GL(dl_profile_map),
-				   GLRO(dl_profile_output));
+	_dl_start_profile (GL(dl_profile_map), GLRO(dl_profile_output));
 
       if (GL(dl_rtld_map).l_opencount > 1)
 	{
 	  /* There was an explicit ref to the dynamic linker as a shared lib.
 	     Re-relocate ourselves with user-controlled symbol definitions.  */
 	  HP_TIMING_NOW (start);
-	  INTUSE(_dl_relocate_object) (&GL(dl_rtld_map), GL(dl_loaded)->l_scope,
-				       0, 0);
+	  _dl_relocate_object (&GL(dl_rtld_map), GL(dl_loaded)->l_scope, 0, 0);
 	  HP_TIMING_NOW (stop);
 	  HP_TIMING_DIFF (add, start, stop);
 	  HP_TIMING_ACCUM_NT (relocate_time, add);
@@ -1854,11 +1867,11 @@ cannot allocate TLS data structures for initial thread");
 
   /* Notify the debugger that all objects are now mapped in.  */
   r->r_state = RT_ADD;
-  INTUSE(_dl_debug_state) ();
+  _dl_debug_state ();
 
 #ifndef MAP_COPY
   /* We must munmap() the cache file.  */
-  INTUSE(_dl_unload_cache) ();
+  _dl_unload_cache ();
 #endif
 
   /* Once we return, _dl_sysdep_start will invoke
@@ -2211,9 +2224,8 @@ print_statistics (hp_timing_t *rtld_total_timep)
   if (HP_TIMING_AVAIL)
     {
       HP_TIMING_PRINT (buf, sizeof (buf), *rtld_total_timep);
-      INTUSE(_dl_debug_printf) ("\nruntime linker statistics:\n"
-				"  total startup time in dynamic loader: %s\n",
-				buf);
+      _dl_debug_printf ("\nruntime linker statistics:\n"
+			"  total startup time in dynamic loader: %s\n", buf);
 
       /* Print relocation statistics.  */
       char pbuf[30];
@@ -2232,9 +2244,8 @@ print_statistics (hp_timing_t *rtld_total_timep)
 	  *wp++ = *cp++;
 	}
       *wp = '\0';
-      INTUSE(_dl_debug_printf) ("\
-            time needed for relocation: %s (%s%%)\n",
-				buf, pbuf);
+      _dl_debug_printf ("\
+            time needed for relocation: %s (%s%%)\n", buf, pbuf);
     }
 #endif
 
@@ -2255,12 +2266,12 @@ print_statistics (hp_timing_t *rtld_total_timep)
 	num_relative_relocations += l->l_info[VERSYMIDX (DT_RELACOUNT)]->d_un.d_val;
     }
 
-  INTUSE(_dl_debug_printf) ("                 number of relocations: %lu\n",
-			    GL(dl_num_relocations));
-  INTUSE(_dl_debug_printf) ("      number of relocations from cache: %lu\n",
-			    GL(dl_num_cache_relocations));
-  INTUSE(_dl_debug_printf) ("        number of relative relocations: %lu\n",
-			    num_relative_relocations);
+  _dl_debug_printf ("                 number of relocations: %lu\n",
+		    GL(dl_num_relocations));
+  _dl_debug_printf ("      number of relocations from cache: %lu\n",
+		    GL(dl_num_cache_relocations));
+  _dl_debug_printf ("        number of relative relocations: %lu\n",
+		    num_relative_relocations);
 
 #ifndef HP_TIMING_NONAVAIL
   /* Time spend while loading the object and the dependencies.  */
@@ -2282,7 +2293,7 @@ print_statistics (hp_timing_t *rtld_total_timep)
 	  *wp++ = *cp++;
 	}
       *wp = '\0';
-      INTUSE(_dl_debug_printf) ("\
+      _dl_debug_printf ("\
            time needed to load objects: %s (%s%%)\n",
 				buf, pbuf);
     }
diff --git a/include/dlfcn.h b/include/dlfcn.h
index c87b6d9c91..f36e3a23ac 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -64,10 +64,6 @@ extern int _dl_catch_error (const char **objname, const char **errstring,
 			    void (*operate) (void *),
 			    void *args)
      internal_function;
-extern int _dl_catch_error_internal (const char **objname,
-				     const char **errstring,
-				     void (*operate) (void *), void *args)
-     internal_function;
 
 /* Helper function for <dlfcn.h> functions.  Runs the OPERATE function via
    _dl_catch_error.  Returns zero for success, nonzero for failure; and
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
index 5a44148a44..2861dc2613 100644
--- a/sysdeps/generic/dl-cache.c
+++ b/sysdeps/generic/dl-cache.c
@@ -188,7 +188,7 @@ _dl_load_cache_lookup (const char *name)
 
   /* Print a message if the loading of libs is traced.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
-    INTUSE(_dl_debug_printf) (" search cache=%s\n", LD_SO_CACHE);
+    _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
 
   if (cache == NULL)
     {
@@ -291,7 +291,7 @@ _dl_load_cache_lookup (const char *name)
   /* Print our result if wanted.  */
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
       && best != NULL)
-    INTUSE(_dl_debug_printf) ("  trying file=%s\n", best);
+    _dl_debug_printf ("  trying file=%s\n", best);
 
   return best;
 }
@@ -310,5 +310,4 @@ _dl_unload_cache (void)
       cache = NULL;
     }
 }
-INTDEF (_dl_unload_cache)
 #endif
diff --git a/sysdeps/generic/dl-fptr.c b/sysdeps/generic/dl-fptr.c
index 1ed463717d..78beecfdcb 100644
--- a/sysdeps/generic/dl-fptr.c
+++ b/sysdeps/generic/dl-fptr.c
@@ -1,5 +1,5 @@
 /* Manage function descriptors.  Generic version.
-   Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1999,2000,2001,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
@@ -80,12 +80,12 @@ new_fdesc_table (struct local *l, size_t *size)
   if (! COMPARE_AND_SWAP (&l->npages, old_npages, new_npages))
     return (struct fdesc_table *) NULL;
 
-  *size = old_npages * GL(dl_pagesize);
+  *size = old_npages * GLRO(dl_pagesize);
   new_table = __mmap (NULL, *size,
 		      PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
   if (new_table == MAP_FAILED)
-    INTUSE(_dl_signal_error) (errno, NULL, NULL,
-			      N_("cannot map pages for fdesc table"));
+    _dl_signal_error (errno, NULL, NULL,
+		      N_("cannot map pages for fdesc table"));
 
   new_table->len
     = (*size - sizeof (*new_table)) / sizeof (struct fdesc);
@@ -178,8 +178,8 @@ make_fptr_table (struct link_map *map)
      afterwards...  */
   len = ((strtab - (char *) symtab)
 	 / map->l_info[DT_SYMENT]->d_un.d_val);
-  size = ((len * sizeof (fptr_table[0]) + GL(dl_pagesize) - 1)
-	  & -GL(dl_pagesize));
+  size = ((len * sizeof (fptr_table[0]) + GLRO(dl_pagesize) - 1)
+	  & -GLRO(dl_pagesize));
   /* XXX We don't support here in the moment systems without MAP_ANON.
      There probably are none for IA-64.  In case this is proven wrong
      we will have to open /dev/null here and use the file descriptor
@@ -188,8 +188,8 @@ make_fptr_table (struct link_map *map)
 		       PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE,
 		       -1, 0);
   if (fptr_table == MAP_FAILED)
-    INTUSE(_dl_signal_error) (errno, NULL, NULL,
-			      N_("cannot map pages for fptr table"));
+    _dl_signal_error (errno, NULL, NULL,
+		      N_("cannot map pages for fptr table"));
 
   if (COMPARE_AND_SWAP ((ElfW(Addr) *) &map->l_mach.fptr_table,
 			(ElfW(Addr)) NULL, (ElfW(Addr)) fptr_table))
@@ -217,8 +217,8 @@ _dl_make_fptr (struct link_map *map, const ElfW(Sym) *sym,
   symidx = sym - symtab;
 
   if (symidx >= map->l_mach.fptr_table_len)
-    INTUSE(_dl_signal_error) (0, NULL, NULL, N_("\
-internal error: symidx out of range of fptr table"));
+    _dl_signal_error (0, NULL, NULL,
+		      N_("internal error: symidx out of range of fptr table"));
 
   while (ftab[symidx] == 0)
     {
diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c
index 4837c2e721..87619379bc 100644
--- a/sysdeps/generic/dl-origin.c
+++ b/sysdeps/generic/dl-origin.c
@@ -26,7 +26,6 @@
 #include <dl-dst.h>
 
 
-#undef _dl_get_origin
 const char *
 _dl_get_origin (void)
 {
@@ -50,4 +49,3 @@ _dl_get_origin (void)
 
   return result;
 }
-INTDEF(_dl_get_origin)
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index e9eccd5dc3..3447f4cd4c 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -416,8 +416,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
 #ifndef USE_TLS
     no_memory:
 #endif
-      INTUSE(_dl_signal_error) (ENOMEM, NULL, NULL,
-				N_("cannot create capability list"));
+      _dl_signal_error (ENOMEM, NULL, NULL,
+			N_("cannot create capability list"));
     }
 
   if (cnt == 1)
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index e0ffcc06d3..4fe67da4e1 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  Generic version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 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
@@ -505,32 +505,6 @@ rtld_hidden_def (_dl_deallocate_tls)
 #  ifndef GET_ADDR_OFFSET
 #   define GET_ADDR_OFFSET ti->ti_offset
 #  endif
-/* Systems which do not have tls_index also probably have to define
-   DONT_USE_TLS_INDEX.  */
-
-#  ifndef __TLS_GET_ADDR
-#   define __TLS_GET_ADDR __tls_get_addr
-#  endif
-
-
-/* Return the symbol address given the map of the module it is in and
-   the symbol record.  This is used in dl-sym.c.  */
-void *
-internal_function
-_dl_tls_symaddr (struct link_map *map, const ElfW(Sym) *ref)
-{
-#  ifndef DONT_USE_TLS_INDEX
-  tls_index tmp =
-    {
-      .ti_module = map->l_tls_modid,
-      .ti_offset = ref->st_value
-    };
-
-  return __TLS_GET_ADDR (&tmp);
-#  else
-  return __TLS_GET_ADDR (map->l_tls_modid, ref->st_value);
-#  endif
-}
 
 
 static void *
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 98294cb05d..e6e144f9eb 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -447,14 +447,74 @@ struct rtld_global_ro
 #endif
 
 #ifdef SHARED
+  /* We add a function table to _rtld_global which is then used to
+     call the function instead of going through the PLT.  The result
+     is that we can avoid exporting the functions and we do not jump
+     PLT relocations in libc.so.  */
+  const char *(*_dl_get_origin) (void);
+  size_t (*_dl_dst_count) (const char *, int);
+  char *(*_dl_dst_substitute) (struct link_map *, const char *, char *, int);
+  struct link_map *(internal_function *_dl_map_object) (struct link_map *,
+							const char *, int,
+							int, int, int);
+  void (internal_function *_dl_map_object_deps) (struct link_map *,
+						 struct link_map **,
+						 unsigned int, int, int);
+  void (*_dl_relocate_object) (struct link_map *, struct r_scope_elem *[],
+			       int, int);
+  int (internal_function *_dl_check_map_versions) (struct link_map *, int,
+						   int);
+  void (internal_function *_dl_init) (struct link_map *, int, char **,
+					char **);
+  void (*_dl_debug_state) (void);
+#ifndef MAP_COPY
+  void (*_dl_unload_cache) (void);
+#endif
+  void (*_dl_debug_printf) (const char *, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
+  int (internal_function *_dl_catch_error) (const char **, const char **,
+					    void (*) (void *), void *);
+  void (internal_function *_dl_signal_error) (int, const char *, const char *,
+					      const char *);
+  void (internal_function *_dl_start_profile) (struct link_map *,
+					       const char *);
+  void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
+  lookup_t (internal_function *_dl_lookup_symbol) (const char *,
+						   struct link_map *,
+						   const ElfW(Sym) **,
+						   struct r_scope_elem *[],
+						   int, int);
+  lookup_t (internal_function *_dl_lookup_versioned_symbol) (const char *,
+							     struct link_map *,
+							     const ElfW(Sym) **,
+							     struct r_scope_elem *[],
+							     const struct r_found_version *,
+							     int, int);
+  lookup_t (internal_function *_dl_lookup_symbol_skip) (const char *,
+							struct link_map *,
+							const ElfW(Sym) **,
+							struct r_scope_elem *[],
+							struct link_map *);
+  lookup_t (internal_function *_dl_lookup_versioned_symbol_skip) (const char *,
+								  struct link_map *,
+								  const ElfW(Sym) **,
+								  struct r_scope_elem *[],
+								  const struct r_found_version *,
+								  struct link_map *);
+
 };
 # define __rtld_global_attribute__
 # ifdef IS_IN_rtld
 extern struct rtld_global_ro _rtld_local_ro
     attribute_relro __rtld_local_attribute__;
-# endif
 extern struct rtld_global_ro _rtld_global_ro
     attribute_relro __rtld_global_attribute__;
+# else
+/* We cheat a bit here.  We declare the variable as as const even
+   though it is at startup.  */
+extern const struct rtld_global_ro _rtld_global_ro
+    attribute_relro __rtld_global_attribute__;
+# endif
 #endif
 #undef EXTERN
 
@@ -518,10 +578,7 @@ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
    interpreted as for a `printf' call.  All the lines start with a
    tag showing the PID.  */
 extern void _dl_debug_printf (const char *fmt, ...)
-     __attribute__ ((__format__ (__printf__, 1, 2)));
-extern void _dl_debug_printf_internal (const char *fmt, ...)
-     __attribute__ ((__format__ (__printf__, 1, 2)))
-     attribute_hidden;
+     __attribute__ ((__format__ (__printf__, 1, 2))) attribute_hidden;
 
 /* Write message on the debug file descriptor.  The parameters are
    interpreted as for a `printf' call.  All the lines buf the first
@@ -564,11 +621,6 @@ extern void _dl_dprintf (int fd, const char *fmt, ...)
    problem.  */
 extern void _dl_signal_error (int errcode, const char *object,
 			      const char *occurred, const char *errstring)
-     internal_function
-     __attribute__ ((__noreturn__));
-extern void _dl_signal_error_internal (int errcode, const char *object,
-				       const char *occurred,
-				       const char *errstring)
      internal_function __attribute__ ((__noreturn__)) attribute_hidden;
 
 /* Like _dl_signal_error, but may return when called in the context of
@@ -594,12 +646,6 @@ extern void _dl_receive_error (receiver_fct fct, void (*operate) (void *),
 extern struct link_map *_dl_map_object (struct link_map *loader,
 					const char *name, int preloaded,
 					int type, int trace_mode, int mode)
-     internal_function;
-extern struct link_map *_dl_map_object_internal (struct link_map *loader,
-						 const char *name,
-						 int preloaded,
-						 int type, int trace_mode,
-						 int mode)
      internal_function attribute_hidden;
 
 /* Call _dl_map_object on the dependencies of MAP, and set up
@@ -610,11 +656,6 @@ extern void _dl_map_object_deps (struct link_map *map,
 				 struct link_map **preloads,
 				 unsigned int npreloads, int trace_mode,
 				 int open_mode)
-     internal_function;
-extern void _dl_map_object_deps_internal (struct link_map *map,
-					  struct link_map **preloads,
-					  unsigned int npreloads,
-					  int trace_mode, int open_mode)
      internal_function attribute_hidden;
 
 /* Cache the locations of MAP's hash table.  */
@@ -646,12 +687,6 @@ extern lookup_t _dl_lookup_symbol (const char *undef,
 				   const ElfW(Sym) **sym,
 				   struct r_scope_elem *symbol_scope[],
 				   int type_class, int flags)
-     internal_function;
-extern lookup_t _dl_lookup_symbol_internal (const char *undef,
-					    struct link_map *undef_map,
-					    const ElfW(Sym) **sym,
-					    struct r_scope_elem *symbolscope[],
-					    int type_class, int flags)
      internal_function attribute_hidden;
 
 enum
@@ -670,14 +705,6 @@ extern lookup_t _dl_lookup_versioned_symbol (const char *undef,
 					     struct r_scope_elem *symbol_scope[],
 					     const struct r_found_version *version,
 					     int type_class, int explicit)
-     internal_function;
-extern lookup_t _dl_lookup_versioned_symbol_internal (const char *undef,
-						      struct link_map *undef_map,
-						      const ElfW(Sym) **sym,
-						      struct r_scope_elem *symbol_scope[],
-						      const struct r_found_version *version,
-						      int type_class,
-						      int explicit)
      internal_function attribute_hidden;
 
 /* For handling RTLD_NEXT we must be able to skip shared objects.  */
@@ -713,10 +740,7 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname,
    If LAZY is nonzero, don't relocate its PLT.  */
 extern void _dl_relocate_object (struct link_map *map,
 				 struct r_scope_elem *scope[],
-				 int lazy, int consider_profiling);
-extern void _dl_relocate_object_internal (struct link_map *map,
-					  struct r_scope_elem *scope[],
-					  int lazy, int consider_profiling)
+				 int lazy, int consider_profiling)
      attribute_hidden;
 
 /* Protect PT_GNU_RELRO area.  */
@@ -750,7 +774,7 @@ extern int _dl_check_map_versions (struct link_map *map, int verbose,
 /* Initialize the object in SCOPE by calling the constructors with
    ARGC, ARGV, and ENV as the parameters.  */
 extern void _dl_init (struct link_map *main_map, int argc, char **argv,
-		      char **env) internal_function;
+		      char **env) internal_function attribute_hidden;
 
 /* Call the finalizer functions of all shared objects whose
    initializer functions have completed.  */
@@ -760,8 +784,7 @@ extern void _dl_fini (void) internal_function;
    any shared object mappings.  The `r_state' member of `struct r_debug'
    says what change is taking place.  This function's address is
    the value of the `r_brk' member.  */
-extern void _dl_debug_state (void);
-extern void _dl_debug_state_internal (void) attribute_hidden;
+extern void _dl_debug_state (void) attribute_hidden;
 
 /* Initialize `struct r_debug' if it has not already been done.  The
    argument is the run-time load address of the dynamic linker, to be put
@@ -775,9 +798,6 @@ extern void _dl_init_paths (const char *library_path) internal_function;
 /* Gather the information needed to install the profiling tables and start
    the timers.  */
 extern void _dl_start_profile (struct link_map *map, const char *output_dir)
-     internal_function;
-extern void _dl_start_profile_internal (struct link_map *map,
-					const char *output_dir)
      internal_function attribute_hidden;
 
 /* The actual functions used to keep book on the calls.  */
@@ -813,8 +833,7 @@ extern const char *_dl_load_cache_lookup (const char *name)
    all the time since this would create problems when the file is replaced.
    Therefore we provide this function to close the file and open it again
    once needed.  */
-extern void _dl_unload_cache (void);
-extern void _dl_unload_cache_internal (void) attribute_hidden;
+extern void _dl_unload_cache (void) attribute_hidden;
 
 /* System-dependent function to read a file's whole contents in the
    most convenient manner available.  *SIZEP gets the size of the
@@ -871,15 +890,20 @@ rtld_hidden_proto (_dl_allocate_tls_init)
 extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function;
 rtld_hidden_proto (_dl_deallocate_tls)
 
-/* Return the symbol address given the map of the module it is in and
-   the symbol record.  */
-extern void *_dl_tls_symaddr (struct link_map *map, const ElfW(Sym) *ref)
-     internal_function;
-
 #if defined USE_TLS
 extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
 #endif
 
+/* Find origin of the executable.  */
+extern const char *_dl_get_origin (void) attribute_hidden;
+
+/* Count DSTs.  */
+extern size_t _dl_dst_count (const char *name, int is_path) attribute_hidden;
+
+/* Substitute DST values.  */
+extern char *_dl_dst_substitute (struct link_map *l, const char *name,
+				 char *result, int is_path) attribute_hidden;
+
 __END_DECLS
 
 #endif /* ldsodefs.h */
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index 9edbf8e123..b92ab04fdb 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -174,7 +174,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
   /* Call the initializer of the program, if any.  */
 #ifdef SHARED
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-    _dl_debug_printf ("\ninitialize program: %s\n\n", argv[0]);
+    GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
 #endif
   if (init)
     (*init) (
@@ -185,7 +185,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
 
 #ifdef SHARED
   if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-    _dl_debug_printf ("\ntransferring control: %s\n\n", argv[0]);
+    GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
 #endif
 
 #ifdef HAVE_CLEANUP_JMP_BUF
diff --git a/sysdeps/i386/dl-tls.h b/sysdeps/i386/dl-tls.h
index b34bbe2c9e..a1707197ce 100644
--- a/sysdeps/i386/dl-tls.h
+++ b/sysdeps/i386/dl-tls.h
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  i386 version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 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
@@ -33,6 +33,7 @@ extern void *___tls_get_addr (tls_index *ti)
 extern void *___tls_get_addr_internal (tls_index *ti)
      __attribute__ ((__regparm__ (1))) attribute_hidden;
 
+# ifdef IS_IN_rtld
 /* The special thing about the x86 TLS ABI is that we have two
    variants of the __tls_get_addr function with different calling
    conventions.  The GNU version, which we are mostly concerned here,
@@ -50,5 +51,10 @@ __tls_get_addr (tls_index *ti)
    version of this file.  */
 # define __tls_get_addr __attribute__ ((__regparm__ (1))) ___tls_get_addr
 strong_alias (___tls_get_addr, ___tls_get_addr_internal)
-# define __TLS_GET_ADDR ___tls_get_addr_internal
+#else
+
+/* Users should get the better interface.  */
+# define __tls_get_addr ___tls_get_addr
+
+# endif
 #endif
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 5e2a6f1c4f..ec3bfdb835 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Hurd version.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -252,7 +252,7 @@ unfmh();			/* XXX */
   __mach_init ();
 
   /* Initialize frequently used global variable.  */
-  GL(dl_pagesize) = __getpagesize ();
+  GLRO(dl_pagesize) = __getpagesize ();
 
 #if HP_TIMING_AVAIL
   HP_TIMING_NOW (_dl_cpuclock_offset);
diff --git a/sysdeps/unix/sysv/linux/dl-origin.c b/sysdeps/unix/sysv/linux/dl-origin.c
index 690492093d..f7512340a1 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.c
+++ b/sysdeps/unix/sysv/linux/dl-origin.c
@@ -31,7 +31,6 @@
    the path of the application from the /proc/self/exe symlink.  Try this
    first and fall back on the generic method if necessary.  */
 
-#undef _dl_get_origin
 const char *
 _dl_get_origin (void)
 {
@@ -77,4 +76,3 @@ _dl_get_origin (void)
 
   return result;
 }
-INTDEF(_dl_get_origin)
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-static.c b/sysdeps/unix/sysv/linux/ia64/dl-static.c
index 6489068f48..691ba31582 100644
--- a/sysdeps/unix/sysv/linux/ia64/dl-static.c
+++ b/sysdeps/unix/sysv/linux/ia64/dl-static.c
@@ -1,5 +1,5 @@
 /* Variable initialization.  IA-64 version.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 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
@@ -31,8 +31,8 @@ _dl_var_init (void *array[])
       DL_CLKTCK
     };
 
-  GL(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]);
-  GL(dl_clktck) = *((int *) array[DL_CLKTCK]);
+  GLRO(dl_pagesize) = *((size_t *) array[DL_PAGESIZE]);
+  GLRO(dl_clktck) = *((int *) array[DL_CLKTCK]);
 }
 
 #else
@@ -42,8 +42,8 @@ __libc_lock_define_initialized_recursive (static, _dl_static_lock)
 
 static void *variables[] =
 {
-  &GL(dl_pagesize),
-  &GL(dl_clktck)
+  &GLRO(dl_pagesize),
+  &GLRO(dl_clktck)
 };
 
 void
diff --git a/sysdeps/unix/sysv/linux/ia64/getpagesize.c b/sysdeps/unix/sysv/linux/ia64/getpagesize.c
index 745e47ff02..1155dfdad1 100644
--- a/sysdeps/unix/sysv/linux/ia64/getpagesize.c
+++ b/sysdeps/unix/sysv/linux/ia64/getpagesize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2002, 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
@@ -32,8 +32,8 @@
 int
 __getpagesize ()
 {
-  assert (GL(dl_pagesize) != 0);
-  return GL(dl_pagesize);
+  assert (GLRO(dl_pagesize) != 0);
+  return GLRO(dl_pagesize);
 }
 libc_hidden_def (__getpagesize)
 weak_alias (__getpagesize, getpagesize)
diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
index 10a437b06e..f7ffdc5185 100644
--- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c
+++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Schwab <schwab@suse.de>.
 
@@ -33,8 +33,8 @@ __getpagesize ()
   int result;
 #endif
 
-  if (GL(dl_pagesize) != 0)
-    return GL(dl_pagesize);
+  if (GLRO(dl_pagesize) != 0)
+    return GLRO(dl_pagesize);
 
 #ifdef __NR_getpagesize
   INTERNAL_SYSCALL_DECL (err);
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c
index 42ef9d332e..00bbdc744f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 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
@@ -31,12 +31,12 @@
 int
 __getpagesize ()
 {
-  if (GL(dl_pagesize) == 0)
+  if (GLRO(dl_pagesize) == 0)
     {
       INTERNAL_SYSCALL_DECL (err);
-      GL(dl_pagesize) = INTERNAL_SYSCALL (getpagesize, err, 0);
+      GLRO(dl_pagesize) = INTERNAL_SYSCALL (getpagesize, err, 0);
     }
-  return GL(dl_pagesize);
+  return GLRO(dl_pagesize);
 }
 libc_hidden_def (__getpagesize)
 weak_alias (__getpagesize, getpagesize)