diff --git a/tcccoff.c b/tcccoff.c index 1ee9b0c4..ddb296d1 100644 --- a/tcccoff.c +++ b/tcccoff.c @@ -940,7 +940,7 @@ int tcc_load_coff(TCCState * s1, int fd) if (name[0] == '_' && strcmp(name, "_main") != 0) name++; - tcc_add_symbol(s1, name, csym.n_value); + tcc_add_symbol(s1, name, (void*)csym.n_value); } // skip any aux records diff --git a/tccelf.c b/tccelf.c index 1f488f92..805a885d 100644 --- a/tccelf.c +++ b/tccelf.c @@ -177,7 +177,7 @@ void *tcc_get_symbol(TCCState *s, const char *name) if (!sym_index) return NULL; sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; - return (void*)sym->st_value; + return (void*)(long)sym->st_value; } void *tcc_get_symbol_err(TCCState *s, const char *name)