about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-17 17:50:43 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-17 17:50:43 +0000
commita735f53e6ab094bce9b992dd3d3127fdb4ffdcc2 (patch)
tree75caa26bf681b5d87808c035bf48d3caa409edae
parent301335a80b85f12c018e4acf1a2c28615e119f8d (diff)
downloadmusl-a735f53e6ab094bce9b992dd3d3127fdb4ffdcc2.tar.gz
musl-a735f53e6ab094bce9b992dd3d3127fdb4ffdcc2.tar.xz
musl-a735f53e6ab094bce9b992dd3d3127fdb4ffdcc2.zip
further refactoring of dynamic linker load address computations
these are in do_relocs. the first one was omitted in commit
301335a80b85f12c018e4acf1a2c28615e119f8d because it slightly changes
code (using dso->base rather than cached local var base) and would
have prevented easy verification. the other was an oversight.
-rw-r--r--src/ldso/dynlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 75fae762..6e79a77e 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -288,7 +288,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
 		type = R_TYPE(rel[1]);
 		if (type == REL_NONE) continue;
 		sym_index = R_SYM(rel[1]);
-		reloc_addr = (void *)(base + rel[0]);
+		reloc_addr = laddr(dso, rel[0]);
 		if (sym_index) {
 			sym = syms + sym_index;
 			name = strings + sym->st_name;
@@ -322,7 +322,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
 			addend = *reloc_addr;
 		}
 
-		sym_val = def.sym ? (size_t)def.dso->base+def.sym->st_value : 0;
+		sym_val = def.sym ? (size_t)laddr(def.dso, def.sym->st_value) : 0;
 		tls_val = def.sym ? def.sym->st_value : 0;
 
 		switch(type) {