aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authormob <mob>2012-02-26 19:02:51 -0600
committermob <mob>2012-02-26 19:02:51 -0600
commitd7a7c3769d0a1dcb8400258cd8adf78a8566de61 (patch)
tree1333ad336c0626f41ec5690ea9e34c908c967d60 /libtcc.c
parent6e13c35334200e7ef918308aeb820404d7b35283 (diff)
downloadtinycc-d7a7c3769d0a1dcb8400258cd8adf78a8566de61.tar.gz
tinycc-d7a7c3769d0a1dcb8400258cd8adf78a8566de61.tar.bz2
Multiple fixes for 64 bit sections
This changeset attempts to fix a few problems when giving using the high 32bits of a 64bit section offset. There are likely more issues (or perhaps regressions) lurking in the muck here. In general, this moves a few data type declarations to use uplong. Also, add support for 64bit mingw32 building under cygwin. Because native types are used for 64 bit offsets, this won't fix challenges with cross compiling from 32bit -> 64bit. Tested under cygwin, against binary compiled with -Wl,-Ttext=0xffffff8000000000 Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libtcc.c b/libtcc.c
index 8f5cd0e..159e23b 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);
}
@@ -1493,7 +1493,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;
@@ -1562,9 +1562,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;
}