about summary refs log tree commit diff
path: root/src/ldso/dynlink.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-25 22:36:21 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-25 22:36:21 -0400
commit32de61e81a64c8bb2cd23e3476f00433692f8e59 (patch)
tree1c078d393681448b498d865db9550d4d209732fa /src/ldso/dynlink.c
parent1a3ff4f9099cf3d6b65a77cf9bfb7f69a7698a30 (diff)
downloadmusl-32de61e81a64c8bb2cd23e3476f00433692f8e59.tar.gz
musl-32de61e81a64c8bb2cd23e3476f00433692f8e59.tar.xz
musl-32de61e81a64c8bb2cd23e3476f00433692f8e59.zip
fix some symbol resolution issues in dynamic linker
1. search was wrongly beginning with lib itself rather than dso head
2. inconsistent resolution of function pointers for functions in plt
Diffstat (limited to 'src/ldso/dynlink.c')
-rw-r--r--src/ldso/dynlink.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 472e389d..9e9415ca 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -114,7 +114,7 @@ static void do_relocs(unsigned char *base, size_t *rel, size_t rel_size, size_t
 			sym = syms + sym_index;
 			name = strings + sym->st_name;
 			ctx = IS_COPY(type) ? dso->next : dso;
-			sym_val = (size_t)find_sym(ctx, name, 1);
+			sym_val = (size_t)find_sym(ctx, name, IS_PLT(type));
 			sym_size = sym->st_size;
 		}
 		do_single_reloc(reloc_addr, type, sym_val, sym_size, base, rel[2]);
@@ -335,11 +335,11 @@ static void reloc_all(struct dso *p)
 		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, p);
+			2+(dyn[DT_PLTREL]==DT_RELA), p->syms, p->strings, head);
 		do_relocs(p->base, (void *)(p->base+dyn[DT_REL]), dyn[DT_RELSZ],
-			2, p->syms, p->strings, p);
+			2, p->syms, p->strings, head);
 		do_relocs(p->base, (void *)(p->base+dyn[DT_RELA]), dyn[DT_RELASZ],
-			3, p->syms, p->strings, p);
+			3, p->syms, p->strings, head);
 		p->relocated = 1;
 	}
 }