aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-04-16 21:50:43 +0200
committergrischka <grischka>2009-04-18 15:08:02 +0200
commitb1697be6917ecf16013d8467329bccff6a9e5b9f (patch)
treef6f07ee593d0978149d85c8a967a89c8515ed482 /tccelf.c
parent795f67428e7863353d7c466c211d8fcbb9e8c988 (diff)
downloadtinycc-b1697be6917ecf16013d8467329bccff6a9e5b9f.tar.gz
tinycc-b1697be6917ecf16013d8467329bccff6a9e5b9f.tar.bz2
change tcc_add/get_symbol to use void*
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/tccelf.c b/tccelf.c
index 87c91c3..6a26831 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -169,25 +169,24 @@ static int find_elf_sym(Section *s, const char *name)
}
/* return elf symbol value or error */
-int tcc_get_symbol(TCCState *s, unsigned long *pval, const char *name)
+void *tcc_get_symbol(TCCState *s, const char *name)
{
int sym_index;
ElfW(Sym) *sym;
-
sym_index = find_elf_sym(symtab_section, name);
if (!sym_index)
- return -1;
+ return NULL;
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
- *pval = sym->st_value;
- return 0;
+ return (void*)sym->st_value;
}
void *tcc_get_symbol_err(TCCState *s, const char *name)
{
- unsigned long val;
- if (tcc_get_symbol(s, &val, name) < 0)
+ void *sym;
+ sym = tcc_get_symbol(s, name);
+ if (!sym)
error("%s not defined", name);
- return (void *)val;
+ return sym;
}
/* add an elf symbol : check if it is already defined and patch