summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile2
-rw-r--r--elf/dl-load.c11
-rw-r--r--elf/dl-object.c10
-rw-r--r--elf/dl-support.c9
-rw-r--r--elf/dl-sysdep.c3
-rw-r--r--elf/elf.h2
-rw-r--r--elf/rtld.c2
7 files changed, 24 insertions, 15 deletions
diff --git a/elf/Makefile b/elf/Makefile
index e509153547..abb9572166 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -800,7 +800,7 @@ $(objpfx)tst-array5-static.out: $(objpfx)tst-array5-static
cmp $@ tst-array5-static.exp > /dev/null
ifeq (yesyes,$(have-fpie)$(build-shared))
-CFLAGS-tst-pie1.c += -fpie
+CFLAGS-tst-pie1.c += $(pie-ccflag)
$(objpfx)tst-pie1.out: $(objpfx)tst-pie1
$(elf-objpfx)$(rtld-installed-name) \
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 94531b271f..8a8936f7bd 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -163,7 +163,7 @@ static const size_t system_dirs_len[] =
/* Local version of `strdup' function. */
-static inline char *
+static char *
local_strdup (const char *s)
{
size_t len = strlen (s) + 1;
@@ -1470,15 +1470,6 @@ cannot enable executable stack as shared object requires");
{
/* Create an appropriate searchlist. It contains only this map.
This is the definition of DT_SYMBOLIC in SysVr4. */
- l->l_symbolic_searchlist.r_list =
- (struct link_map **) malloc (sizeof (struct link_map *));
-
- if (l->l_symbolic_searchlist.r_list == NULL)
- {
- errstring = N_("cannot create searchlist");
- goto call_lose_errno;
- }
-
l->l_symbolic_searchlist.r_list[0] = l;
l->l_symbolic_searchlist.r_nlist = 1;
diff --git a/elf/dl-object.c b/elf/dl-object.c
index 0e45aea39b..be4ea38f9f 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -1,5 +1,5 @@
/* Storage management for the chain of loaded shared objects.
- Copyright (C) 1995-2002, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2004,2006,2007,2008 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
@@ -50,13 +50,17 @@ _dl_new_object (char *realname, const char *libname, int type,
#endif
new = (struct link_map *) calloc (sizeof (*new) + audit_space
+ + sizeof (struct link_map *)
+ sizeof (*newname) + libname_len, 1);
if (new == NULL)
return NULL;
new->l_real = new;
- new->l_libname = newname = (struct libname_list *) ((char *) (new + 1)
- + audit_space);
+ new->l_symbolic_searchlist.r_list = (struct link_map **) ((char *) (new + 1)
+ + audit_space);
+
+ new->l_libname = newname
+ = (struct libname_list *) (new->l_symbolic_searchlist.r_list + 1);
newname->name = (char *) memcpy (newname + 1, libname, libname_len);
/* newname->next = NULL; We use calloc therefore not necessary. */
newname->dont_free = 1;
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 2c11ac6881..e5b74fb4d6 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
- Copyright (C) 1996-2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-2005, 2006, 2007, 2008 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
@@ -62,8 +62,12 @@ struct link_map *_dl_profile_map;
/* This is the address of the last stack address ever used. */
void *__libc_stack_end;
+#ifndef __ASSUME_AT_EXECFN
/* Path where the binary is found. */
const char *_dl_origin_path;
+#endif
+/* File Name of the executable. */
+const char *_dl_execfn;
/* Nonzero if runtime lookup should not update the .got/.plt. */
int _dl_bind_not;
@@ -216,6 +220,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
__libc_enable_secure = av->a_un.a_val;
__libc_enable_secure_decided = 1;
break;
+ case AT_EXECFN:
+ GLRO(dl_execfn) = (void *) av->a_un.a_val;
+ break;
# ifdef DL_PLATFORM_AUXV
DL_PLATFORM_AUXV
# endif
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index dd55905e14..1ff7a350be 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -173,6 +173,9 @@ _dl_sysdep_start (void **start_argptr,
GLRO(dl_sysinfo_dso) = (void *) av->a_un.a_val;
break;
#endif
+ case AT_EXECFN:
+ GLRO(dl_execfn) = (void *) av->a_un.a_val;
+ break;
#ifdef DL_PLATFORM_AUXV
DL_PLATFORM_AUXV
#endif
diff --git a/elf/elf.h b/elf/elf.h
index 269de527e6..a4134462ac 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -970,6 +970,8 @@ typedef struct
#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
+#define AT_EXECFN 31 /* Filename of executable. */
+
/* Pointer to the global system page used for system calls and other
nice things. */
#define AT_SYSINFO 32
diff --git a/elf/rtld.c b/elf/rtld.c
index 46bece7fa3..3f2267af0e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2579,10 +2579,12 @@ process_envvars (enum mode *modep)
break;
case 11:
+#ifndef __ASSUME_AT_EXECFN
/* Path where the binary is found. */
if (!INTUSE(__libc_enable_secure)
&& memcmp (envline, "ORIGIN_PATH", 11) == 0)
GLRO(dl_origin_path) = &envline[12];
+#endif
break;
case 12: