about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/arm/dl-machine.h40
-rw-r--r--sysdeps/cris/dl-machine.h3
-rw-r--r--sysdeps/generic/dl-origin.c2
-rw-r--r--sysdeps/generic/dl-sysdep.c9
-rw-r--r--sysdeps/generic/ldsodefs.h11
-rw-r--r--sysdeps/hppa/dl-machine.h2
-rw-r--r--sysdeps/i386/dl-machine.h2
-rw-r--r--sysdeps/m68k/dl-machine.h3
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c7
-rw-r--r--sysdeps/powerpc/dl-machine.c2
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h2
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h2
-rw-r--r--sysdeps/sh/dl-machine.h4
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h3
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h3
-rw-r--r--sysdeps/unix/sysv/linux/dl-origin.c4
-rw-r--r--sysdeps/x86_64/dl-machine.h2
17 files changed, 54 insertions, 47 deletions
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 177a375be5..4a7ab3867c 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -377,11 +377,9 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
 
 /* ARM never uses Elf32_Rela relocations for the dynamic linker.
    Prelinked libraries may use Elf32_Rela though.  */
-#ifdef RTLD_BOOTSTRAP
-#define ELF_MACHINE_NO_RELA 1
-#endif
-
-extern char **_dl_argv;
+# ifdef RTLD_BOOTSTRAP
+#  define ELF_MACHINE_NO_RELA 1
+# endif
 
 /* Deal with an out-of-range PC24 reloc.  */
 static Elf32_Addr
@@ -426,15 +424,15 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 
   if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
     {
-#ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
       if (map != &_dl_rtld_map) /* Already done in rtld itself.  */
-#endif
+# endif
 	*reloc_addr += map->l_addr;
     }
-#ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
   else if (__builtin_expect (r_type == R_ARM_NONE, 0))
     return;
-#endif
+# endif
   else
     {
       const Elf32_Sym *const refsym = sym;
@@ -457,7 +455,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
@@ -465,26 +463,26 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	  break;
 	case R_ARM_GLOB_DAT:
 	case R_ARM_JUMP_SLOT:
-#ifdef RTLD_BOOTSTRAP
+# ifdef RTLD_BOOTSTRAP
 	  /* Fix weak undefined references.  */
 	  if (sym != NULL && sym->st_value == 0)
 	    *reloc_addr = 0;
 	  else
-#endif
+# endif
 	    *reloc_addr = value;
 	  break;
 	case R_ARM_ABS32:
 	  {
-#ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
 	   /* This is defined in rtld.c, but nowhere in the static
 	      libc.a; make the reference weak so static programs can
 	      still link.  This declaration cannot be done when
 	      compiling rtld.c (i.e.  #ifdef RTLD_BOOTSTRAP) because
 	      rtld.c contains the common defn for _dl_rtld_map, which
 	      is incompatible with a weak decl in the same file.  */
-# ifndef SHARED
+#  ifndef SHARED
 	    weak_extern (_dl_rtld_map);
-# endif
+#  endif
 	    if (map == &_dl_rtld_map)
 	      /* Undo the relocation done here during bootstrapping.
 		 Now we will relocate it anew, possibly using a
@@ -492,7 +490,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 		 rather than the dynamic linker's built-in definitions
 		 used while loading those libraries.  */
 	      value -= map->l_addr + refsym->st_value;
-#endif
+# endif
 	    *reloc_addr += value;
 	    break;
 	  }
@@ -529,7 +527,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
     }
 }
 
-#ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
 static inline void
 elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		  const Elf32_Sym *sym, const struct r_found_version *version,
@@ -539,10 +537,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 
   if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
     *reloc_addr = map->l_addr + reloc->r_addend;
-#ifndef RTLD_BOOTSTRAP
   else if (__builtin_expect (r_type == R_ARM_NONE, 0))
     return;
-#endif
   else
     {
       const Elf32_Sym *const refsym = sym;
@@ -585,7 +581,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	}
     }
 }
-#endif
+# endif
 
 static inline void
 elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
@@ -594,14 +590,14 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
   *reloc_addr += l_addr;
 }
 
-#ifndef RTLD_BOOTSTRAP
+# ifndef RTLD_BOOTSTRAP
 static inline void
 elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
 			   Elf32_Addr *const reloc_addr)
 {
   *reloc_addr = l_addr + reloc->r_addend;
 }
-#endif
+# endif
 
 static inline void
 elf_machine_lazy_rel (struct link_map *map,
diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h
index 966d86b27b..51ae43d096 100644
--- a/sysdeps/cris/dl-machine.h
+++ b/sysdeps/cris/dl-machine.h
@@ -314,13 +314,12 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (GL(dl_verbose) && sym->st_size < refsym->st_size))
 	    {
-	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c
index db990e6d36..b198f70d5d 100644
--- a/sysdeps/generic/dl-origin.c
+++ b/sysdeps/generic/dl-origin.c
@@ -26,6 +26,7 @@
 #include <dl-dst.h>
 
 
+#undef _dl_get_origin
 const char *
 _dl_get_origin (void)
 {
@@ -49,3 +50,4 @@ _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 3385226de0..1975fe8a66 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -47,7 +47,8 @@ extern void __libc_check_standard_fds (void);
 #ifdef NEED_DL_BASE_ADDR
 ElfW(Addr) _dl_base_addr;
 #endif
-int __libc_enable_secure;
+int __libc_enable_secure = 0;
+INTVARDEF(__libc_enable_secure)
 int __libc_multiple_libcs = 0;	/* Defining this here avoids the inclusion
 				   of init-first.  */
 /* This variable contains the lowest stack address ever used.  */
@@ -89,7 +90,7 @@ _dl_sysdep_start (void **start_argptr,
 # define set_seen(tag) seen |= M ((tag)->a_type)
 #endif
 
-  DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ,
+  DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ,
 			  _dl_auxv);
 
   user_entry = (ElfW(Addr)) ENTRY_POINT;
@@ -156,7 +157,7 @@ _dl_sysdep_start (void **start_argptr,
   SEE (EGID, egid);
 #endif
 
-  __libc_enable_secure = uid != euid || gid != egid;
+  INTUSE(__libc_enable_secure) = uid != euid || gid != egid;
 
 #ifndef HAVE_AUX_PAGESIZE
   if (GL(dl_pagesize) == 0)
@@ -186,7 +187,7 @@ _dl_sysdep_start (void **start_argptr,
   /* If this is a SUID program we make sure that FDs 0, 1, and 2 are
      allocated.  If necessary we are doing it ourself.  If it is not
      possible we stop the program.  */
-  if (__builtin_expect (__libc_enable_secure, 0))
+  if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
     __libc_check_standard_fds ();
 
   (*dl_main) (phdr, phnum, &user_entry);
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 08f5829895..4aa5621c19 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -394,9 +394,19 @@ extern struct rtld_global _rtld_local __rtld_local_attribute__;
 /* Parameters passed to the dynamic linker.  */
 extern int _dl_argc;
 extern char **_dl_argv;
+#ifdef _RTLD_LOCAL
+extern char **_dl_argv_internal attribute_hidden;
+# define rtld_progname (INTUSE(_dl_argv)[0])
+#else
+# define rtld_progname _dl_argv[0]
+#endif
 
 /* The array with message we print as a last resort.  */
 extern const char _dl_out_of_memory[];
+#ifdef _RTLD_LOCAL
+/* XXX #ifdef should go away.  */
+extern const char _dl_out_of_memory_internal[] attribute_hidden;
+#endif
 
 
 /* OS-dependent function to open the zero-fill device.  */
@@ -645,6 +655,7 @@ extern void _dl_start_profile_internal (struct link_map *map,
 
 /* The actual functions used to keep book on the calls.  */
 extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc);
+extern void _dl_mcount_internal (ElfW(Addr) frompc, ElfW(Addr) selfpc);
 
 /* This function is simply a wrapper around the _dl_mcount function
    which does not require a FROMPC parameter since this is the
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
index 6d4249437d..b30a3ba62d 100644
--- a/sysdeps/hppa/dl-machine.h
+++ b/sysdeps/hppa/dl-machine.h
@@ -611,7 +611,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
 	  _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-			    _dl_argv[0] ?: "<program name unknown>",
+			    rtld_progname ?: "<program name unknown>",
 			    strtab + refsym->st_name);
 	}
       memcpy (reloc_addr, (void *) value,
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index f51dab87e2..3edfb00c0a 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -433,7 +433,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index b2e1c6b8b4..ce80aad8fa 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -253,13 +253,12 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (sym->st_size < refsym->st_size && GL(dl_verbose)))
 	    {
-	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 520385513d..883c959bee 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -47,7 +47,8 @@ extern int _dl_argc;
 extern char **_dl_argv;
 extern char **_environ;
 
-int __libc_enable_secure;
+int __libc_enable_secure = 0;
+INTVARDEF(__libc_enable_secure)
 int __libc_multiple_libcs = 0;	/* Defining this here avoids the inclusion
 				   of init-first.  */
 /* This variable containts the lowest stack address ever used.  */
@@ -128,7 +129,7 @@ _dl_sysdep_start (void **start_argptr,
       else
 	_dl_hurd_data = (void *) p;
 
-      __libc_enable_secure = _dl_hurd_data->flags & EXEC_SECURE;
+      INTUSE(__libc_enable_secure) = _dl_hurd_data->flags & EXEC_SECURE;
 
       if (_dl_hurd_data->flags & EXEC_STACK_ARGS &&
 	  _dl_hurd_data->user_entry == 0)
@@ -208,7 +209,7 @@ unfmh();			/* XXX */
 	 environment list.
 
 	 We use memmove, since the locations might overlap.  */
-      if (__libc_enable_secure || _dl_skip_args)
+      if (INTUSE(__libc_enable_secure) || _dl_skip_args)
 	{
 	  char **newp;
 
diff --git a/sysdeps/powerpc/dl-machine.c b/sysdeps/powerpc/dl-machine.c
index 7081466945..28a31f6d91 100644
--- a/sysdeps/powerpc/dl-machine.c
+++ b/sysdeps/powerpc/dl-machine.c
@@ -474,7 +474,7 @@ __process_machine_rela (struct link_map *map,
 	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
 	  _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, onsider re-linking\n",
-			    _dl_argv[0] ?: "<program name unknown>",
+			    rtld_progname ?: "<program name unknown>",
 			    strtab + refsym->st_name);
 	}
       memcpy (reloc_addr, (char *) finaladdr, MIN (sym->st_size,
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 5a8f706ead..557c04e4ea 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -406,7 +406,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	      strtab = (const char *) D_PTR(map,l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index c4f2a45fb8..95056a8ee9 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -374,7 +374,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	      strtab = (const char *) D_PTR (map,l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 74495fabcd..498293cb57 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -442,8 +442,6 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
 /* SH never uses Elf32_Rel relocations.	 */
 #define ELF_MACHINE_NO_REL 1
 
-extern char **_dl_argv;
-
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
@@ -520,7 +518,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 17a1aa6f17..4534464987 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -460,13 +460,12 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (GL(dl_verbose) && sym->st_size < refsym->st_size))
 	    {
-	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index af3b2d21a7..8d9bf7aa67 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -286,13 +286,12 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	  if (sym->st_size > refsym->st_size
 	      || (GL(dl_verbose) && sym->st_size < refsym->st_size))
 	    {
-	      extern char **_dl_argv;
 	      const char *strtab;
 
 	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
diff --git a/sysdeps/unix/sysv/linux/dl-origin.c b/sysdeps/unix/sysv/linux/dl-origin.c
index b054ae2157..3824681fa7 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.c
+++ b/sysdeps/unix/sysv/linux/dl-origin.c
@@ -31,6 +31,7 @@
    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)
 {
@@ -38,7 +39,7 @@ _dl_get_origin (void)
   char *result;
   int len;
 
-  if ((len = __readlink ("/proc/self/exe", linkval, PATH_MAX)) > 0
+  if ((len = __readlink ("/proc/self/exe", linkval, sizeof (linkval))) > 0
       && linkval[0] != '[')
     {
       /* We can use this value.  */
@@ -76,3 +77,4 @@ _dl_get_origin (void)
 
   return result;
 }
+INTDEF(_dl_get_origin)
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 182bd5fbda..2e2eb9fc5c 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -386,7 +386,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
 	      _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				_dl_argv[0] ?: "<program name unknown>",
+				rtld_progname ?: "<program name unknown>",
 				strtab + refsym->st_name);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,