aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lyon <jamesly0n@hotmail.com>2013-04-26 16:42:12 +0100
committerJames Lyon <jamesly0n@hotmail.com>2013-04-26 16:42:12 +0100
commit6ee366e765483f6b48537d97fc81ae56f13d1b7f (patch)
treec9365133ee9c4cf1ec4fcee0641ac9adc2fe825d /lib
parent41d76e1fcbe498b0d01e245f5a2d368a23760101 (diff)
downloadtinycc-6ee366e765483f6b48537d97fc81ae56f13d1b7f.tar.gz
tinycc-6ee366e765483f6b48537d97fc81ae56f13d1b7f.tar.bz2
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/libtcc1.c4
1 files changed, 3 insertions, 1 deletions
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: