summaryrefslogtreecommitdiff
path: root/libexec/rtld-elf
diff options
context:
space:
mode:
authorMatthew N. Dodd <mdodd@FreeBSD.org>2003-06-18 03:34:29 +0000
committerMatthew N. Dodd <mdodd@FreeBSD.org>2003-06-18 03:34:29 +0000
commitda9f24547061aaed0e667eeafd3e29e48fc21224 (patch)
tree7405533ca2f30bdd590fa950b02ca1517b04d559 /libexec/rtld-elf
parent40ebf3e43a04f135fee386d8d766fc35055fcb82 (diff)
Notes
Diffstat (limited to 'libexec/rtld-elf')
-rw-r--r--libexec/rtld-elf/map_object.c1
-rw-r--r--libexec/rtld-elf/rtld.c19
-rw-r--r--libexec/rtld-elf/rtld.h2
3 files changed, 21 insertions, 1 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index 5dc6b8c9f6bd..7ad9dc56e61b 100644
--- a/libexec/rtld-elf/map_object.c
+++ b/libexec/rtld-elf/map_object.c
@@ -309,6 +309,7 @@ obj_free(Obj_Entry *obj)
STAILQ_REMOVE_HEAD(&obj->dagmembers, link);
free(elm);
}
+ free(obj->origin_path);
free(obj->priv);
free(obj);
}
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index ab40371e7291..0dea9e6de3a6 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -602,6 +602,7 @@ digest_dynamic(Obj_Entry *obj, int early)
break;
case DT_RPATH:
+ case DT_RUNPATH: /* XXX: process separately */
/*
* We have to wait until later to process this, because we
* might not have gotten the address of the string table yet.
@@ -628,6 +629,22 @@ digest_dynamic(Obj_Entry *obj, int early)
((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug;
break;
+ case DT_FLAGS:
+ if (dynp->d_un.d_val & DF_ORIGIN) {
+ obj->origin_path = xmalloc(PATH_MAX);
+ if (rtld_dirname(obj->path, obj->origin_path) == -1)
+ die();
+ }
+ if (dynp->d_un.d_val & DF_SYMBOLIC)
+ obj->symbolic = true;
+ if (dynp->d_un.d_val & DF_TEXTREL)
+ obj->textrel = true;
+ if (dynp->d_un.d_val & DF_BIND_NOW)
+ obj->bind_now = true;
+ if (dynp->d_un.d_val & DF_STATIC_TLS)
+ ;
+ break;
+
default:
if (!early) {
dbg("Ignoring d_tag %ld = %#lx", (long)dynp->d_tag,
@@ -1401,7 +1418,7 @@ relocate_objects(Obj_Entry *first, bool bind_now, Obj_Entry *rtldobj)
if (reloc_plt(obj) == -1)
return -1;
/* Relocate the jump slots if we are doing immediate binding. */
- if (bind_now)
+ if (obj->bind_now || bind_now)
if (reloc_jmpslots(obj) == -1)
return -1;
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 21a03c84cf5e..c145fa1bd7e6 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -109,6 +109,7 @@ typedef struct Struct_Obj_Entry {
struct Struct_Obj_Entry *next;
char *path; /* Pathname of underlying file (%) */
+ char *origin_path; /* Directory path of origin file */
int refcount;
int dl_refcount; /* Number of times loaded by dlopen */
@@ -153,6 +154,7 @@ typedef struct Struct_Obj_Entry {
bool rtld; /* True if this is the dynamic linker */
bool textrel; /* True if there are relocations to text seg */
bool symbolic; /* True if generated with "-Bsymbolic" */
+ bool bind_now; /* True if all relocations should be made first */
bool traced; /* Already printed in ldd trace output */
bool jmpslots_done; /* Already have relocated the jump slots */
bool init_done; /* Already have added object to init list */