From ebb874e2164308b1b9a53a2b1f6d1b9f65894059 Mon Sep 17 00:00:00 2001 From: Shinichiro Hamaji Date: Wed, 1 Apr 2009 03:45:18 +0900 Subject: Remove multiple definition error caused by combination of x86-64 and va_list. We need malloc and free to implement va_start and va_end. Since malloc and free may be replaced by #define, we add __builtin_malloc and __builtin_free. --- tcc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tcc.c') diff --git a/tcc.c b/tcc.c index ceca30f..f707791 100644 --- a/tcc.c +++ b/tcc.c @@ -7750,6 +7750,24 @@ static void unary(void) vset(&type, VT_LOCAL, 0); } break; +#ifdef TCC_TARGET_X86_64 + case TOK_builtin_malloc: + { + char *p = file->buf_ptr; + file->buf_ptr = "malloc"; + next_nomacro1(); + file->buf_ptr = p; + goto tok_identifier; + } + case TOK_builtin_free: + { + char *p = file->buf_ptr; + file->buf_ptr = "free"; + next_nomacro1(); + file->buf_ptr = p; + goto tok_identifier; + } +#endif case TOK_INC: case TOK_DEC: t = tok; -- cgit v1.3.1