From 51a7f163ad4a363953ae744afbc12cd7bd381097 Mon Sep 17 00:00:00 2001 From: Shinichiro Hamaji Date: Thu, 16 Apr 2009 02:41:24 +0900 Subject: [PATCH] Work around for the issue TCC doesn't handle -2147483648 properly. TCC produces code which is incompatible with GCC for the following code: printf("%lld\n", (long long)-2147483648); printf("%lld\n", (long long)-2147483649); For now, just avoid using the corner value. --- tccelf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tccelf.c b/tccelf.c index 6cf11e2b..195ac982 100644 --- a/tccelf.c +++ b/tccelf.c @@ -685,7 +685,7 @@ static void relocate_section(TCCState *s1, Section *s) } } long diff = val - addr; - if (diff < -2147483648 || diff > 2147483647) { + if (diff <= -2147483647 || diff > 2147483647) { /* XXX: naive support for over 32bit jump */ if (s1->output_type == TCC_OUTPUT_MEMORY) { val = add_jmp_table(s1, val);