From a0db7162af0f694c25b278984ac66a46fa099000 Mon Sep 17 00:00:00 2001 From: Andrew Mulbrook Date: Sat, 3 Mar 2012 11:10:15 -0600 Subject: Fix assumption of 32bit long on portions of Elf Modify tcc to accept convert full 64bits of specified text section when converting on Win64. Write high bytes to the elf section address as well. This allows creation of elf binaries located in offsets using full 64 bit addresses. Signed-off-by: Andrew Mulbrook --- libtcc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index 9349348..5e497c9 100644 --- a/libtcc.c +++ b/libtcc.c @@ -425,7 +425,7 @@ ST_FUNC Section *find_section(TCCState *s1, const char *name) /* update sym->c so that it points to an external symbol in section 'section' with value 'value' */ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, - unsigned long value, unsigned long size, + uplong value, unsigned long size, int can_add_underscore) { int sym_type, sym_bind, sh_num, info, other; @@ -529,7 +529,7 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, } ST_FUNC void put_extern_sym(Sym *sym, Section *section, - unsigned long value, unsigned long size) + uplong value, unsigned long size) { put_extern_sym2(sym, section, value, size, 1); } @@ -1494,7 +1494,7 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi) if (s->warn_unsupported) tcc_warning("ignoring -fini %s", p); } else if (link_option(option, "image-base=", &p)) { - s->text_addr = strtoul(p, &end, 16); + s->text_addr = strtoull(p, &end, 16); s->has_text_addr = 1; } else if (link_option(option, "init=", &p)) { s->init_symbol = p; @@ -1563,9 +1563,8 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi) #endif } else if (link_option(option, "Ttext=", &p)) { - s->text_addr = strtoul(p, &end, 16); + s->text_addr = strtoull(p, &end, 16); s->has_text_addr = 1; - } else { return option; } -- cgit v1.3.1