aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/tccelf.c b/tccelf.c
index f2210a3..b9f1634 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -665,11 +665,9 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve)
/* Use ld.so to resolve symbol for us (for tcc -run) */
if (do_resolve) {
#if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE
- void *addr;
- name = (char *) symtab_section->link->data + sym->st_name;
- addr = dlsym(RTLD_DEFAULT, name);
+ void *addr = dlsym(RTLD_DEFAULT, name);
if (addr) {
- sym->st_value = (addr_t)addr;
+ sym->st_value = (addr_t) addr;
#ifdef DEBUG_RELOC
printf ("relocate_sym: %s -> 0x%lx\n", name, sym->st_value);
#endif
@@ -686,11 +684,10 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve)
/* only weak symbols are accepted to be undefined. Their
value is zero */
sym_bind = ELFW(ST_BIND)(sym->st_info);
- if (sym_bind == STB_WEAK) {
+ if (sym_bind == STB_WEAK)
sym->st_value = 0;
- } else {
+ else
tcc_error_noabort("undefined symbol '%s'", name);
- }
} else if (sh_num < SHN_LORESERVE) {
/* add section base */
sym->st_value += s1->sections[sym->st_shndx]->sh_addr;