aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c5
-rw-r--r--elf/dl-object.c7
-rw-r--r--elf/ldsodefs.h8
-rw-r--r--elf/rtld.c2
4 files changed, 12 insertions, 10 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 8e6a853..81c1d8b 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -739,7 +739,7 @@ _dl_map_object_from_fd (char *name, int fd, char *realname,
#endif
/* Enter the new object in the list of loaded objects. */
- l = _dl_new_object (realname, name, l_type);
+ l = _dl_new_object (realname, name, l_type, loader != NULL);
if (! l)
lose (ENOMEM, "cannot create shared object descriptor");
l->l_opencount = 1;
@@ -1290,7 +1290,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)) == NULL)
+ || (l = _dl_new_object (name_copy, name, type,
+ loader != NULL)) == NULL)
_dl_signal_error (ENOMEM, name,
"cannot create shared object descriptor");
/* We use an opencount of 0 as a sign for the faked entry. */
diff --git a/elf/dl-object.c b/elf/dl-object.c
index f2ef816..e91beac 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -33,7 +33,7 @@ struct link_map *_dl_default_scope[5];
struct link_map *
internal_function
-_dl_new_object (char *realname, const char *libname, int type)
+_dl_new_object (char *realname, const char *libname, int type, int find_origin)
{
struct link_map *new = malloc (sizeof *new);
struct libname_list *newname = malloc (sizeof *newname);
@@ -62,9 +62,8 @@ _dl_new_object (char *realname, const char *libname, int type)
l->l_next = new;
}
- /* The REALNAME is "" for the main link map. This name must be determined
- specially. */
- if (realname[0] == '\0')
+ /* Don't try to find the origin for the main map. */
+ if (! find_origin)
new->l_origin = NULL;
else
{
diff --git a/elf/ldsodefs.h b/elf/ldsodefs.h
index 847d5ce..b36fcd8 100644
--- a/elf/ldsodefs.h
+++ b/elf/ldsodefs.h
@@ -166,7 +166,7 @@ extern void _dl_sysdep_output (int fd, const char *string, ...);
descriptor for this. All arguments are `const char *'; args until
a null pointer are concatenated to form the message to print. If
NEW_LINE is nonzero it is assumed that the message starts on a new
- line.*/
+ line. */
extern void _dl_debug_message (int new_line, const char *string, ...);
/* OS-dependent function to write a message on the standard output.
@@ -356,9 +356,11 @@ extern struct link_map **_dl_object_relocation_scope (struct link_map *map)
/* Allocate a `struct link_map' for a new object being loaded,
- and enter it into the _dl_loaded list. */
+ and enter it into the _dl_loaded list. If find origin is nonzero
+ determine the origin of the file. */
extern struct link_map *_dl_new_object (char *realname, const char *libname,
- int type) internal_function;
+ int type, int find_origin)
+ internal_function;
/* Relocate the given object (if it hasn't already been).
SCOPE is passed to _dl_lookup_symbol in symbol lookups.
diff --git a/elf/rtld.c b/elf/rtld.c
index 3b3dfbf..600f062 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -420,7 +420,7 @@ of this helper program; chances are you did not intend to run this program.\n\
{
/* Create a link_map for the executable itself.
This will be what dlopen on "" returns. */
- main_map = _dl_new_object ((char *) "", "", lt_executable);
+ main_map = _dl_new_object ((char *) "", "", lt_executable, 0);
if (main_map == NULL)
_dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
main_map->l_phdr = phdr;