From 8f6390061d4e839ad57d69ceb227e4f957b658de Mon Sep 17 00:00:00 2001 From: seyko Date: Mon, 23 Mar 2015 19:24:55 +0300 Subject: fix for: x86_64-tcc compiled by i386-tcc is wrong A test program (must be compiled by the above version of the tcc): /* Tickle a bug in TinyC on 64-bit systems: * the LSB of the top word or ARGP gets set * for no obvious reason. * * Source: a legacy language interpreter which * has a little stack / stack pointer for arguments. * * Output is: 0x8049620 0x10804961c * Should be: 0x8049620 0x804961c */ #include #define NARGS 20000 int ARG[NARGS]; int *ARGSPACE = ARG; int *ARGP = ARG - 1; main() { printf("%p %p\n", ARGSPACE, ARGP); } --- libtcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libtcc.c') diff --git a/libtcc.c b/libtcc.c index b04a5cb..eb69438 100644 --- a/libtcc.c +++ b/libtcc.c @@ -540,7 +540,7 @@ ST_FUNC void put_extern_sym(Sym *sym, Section *section, /* add a new relocation entry to symbol 'sym' in section 's' */ ST_FUNC void greloca(Section *s, Sym *sym, unsigned long offset, int type, - unsigned long addend) + addr_t addend) { int c = 0; if (sym) { -- cgit v1.3.1