about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-05 02:49:02 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-05 02:49:02 -0400
commit87d13a4c33b8f75afac357f46341847ac92e2978 (patch)
treebdf54bc708461cc8cecfe3baebe4567604959065
parent7cb44cd3de59dc3acf5428c19a6a882aa896e6d0 (diff)
downloadmusl-87d13a4c33b8f75afac357f46341847ac92e2978.tar.gz
musl-87d13a4c33b8f75afac357f46341847ac92e2978.tar.xz
musl-87d13a4c33b8f75afac357f46341847ac92e2978.zip
more cleanup of dynamic linker internals
-rw-r--r--src/ldso/dynlink.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 4e5acee7..08f9118d 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -143,8 +143,11 @@ static void *find_sym(struct dso *dso, const char *s, int need_def)
 	return def;
 }
 
-static void do_relocs(unsigned char *base, size_t *rel, size_t rel_size, size_t stride, Sym *syms, char *strings)
+static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stride)
 {
+	unsigned char *base = dso->base;
+	Sym *syms = dso->syms;
+	char *strings = dso->strings;
 	Sym *sym;
 	const char *name;
 	size_t sym_val, sym_size;
@@ -165,7 +168,7 @@ static void do_relocs(unsigned char *base, size_t *rel, size_t rel_size, size_t
 			if (!sym_val && sym->st_info>>4 != STB_WEAK) {
 				snprintf(errbuf, sizeof errbuf,
 					"Error relocating %s: %s: symbol not found",
-					"???", name);
+					dso->name, name);
 				if (runtime) longjmp(rtld_fail, 1);
 				dprintf(2, "%s\n", errbuf);
 				_exit(127);
@@ -484,12 +487,10 @@ static void reloc_all(struct dso *p)
 	for (; p; p=p->next) {
 		if (p->relocated) continue;
 		decode_vec(p->dynv, dyn, DYN_CNT);
-		do_relocs(p->base, (void *)(p->base+dyn[DT_JMPREL]), dyn[DT_PLTRELSZ],
-			2+(dyn[DT_PLTREL]==DT_RELA), p->syms, p->strings);
-		do_relocs(p->base, (void *)(p->base+dyn[DT_REL]), dyn[DT_RELSZ],
-			2, p->syms, p->strings);
-		do_relocs(p->base, (void *)(p->base+dyn[DT_RELA]), dyn[DT_RELASZ],
-			3, p->syms, p->strings);
+		do_relocs(p, (void *)(p->base+dyn[DT_JMPREL]), dyn[DT_PLTRELSZ],
+			2+(dyn[DT_PLTREL]==DT_RELA));
+		do_relocs(p, (void *)(p->base+dyn[DT_REL]), dyn[DT_RELSZ], 2);
+		do_relocs(p, (void *)(p->base+dyn[DT_RELA]), dyn[DT_RELASZ], 3);
 		p->relocated = 1;
 	}
 }