From 6ee366e765483f6b48537d97fc81ae56f13d1b7f Mon Sep 17 00:00:00 2001 From: James Lyon Date: Fri, 26 Apr 2013 16:42:12 +0100 Subject: Fixed x86-64 long double passing. long double arguments require 16-byte alignment on the stack, which requires adjustment when the the stack offset is not an evven number of 8-byte words. --- lib/libtcc1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libtcc1.c b/lib/libtcc1.c index 159c401..53dbec4 100644 --- a/lib/libtcc1.c +++ b/lib/libtcc1.c @@ -645,9 +645,10 @@ void *__va_start(void *fp) void *__va_arg(struct __va_list_struct *ap, enum __va_arg_type arg_type, - int size) + int size, int align) { size = (size + 7) & ~7; + align = (align + 7) & ~7; switch (arg_type) { case __va_gen_reg: if (ap->gp_offset < 48) { @@ -668,6 +669,7 @@ void *__va_arg(struct __va_list_struct *ap, case __va_stack: use_overflow_area: ap->overflow_arg_area += size; + ap->overflow_arg_area = (char*)((long long)(ap->overflow_arg_area + align - 1) & -(long long)align); return ap->overflow_arg_area - size; default: -- cgit v1.3.1