Commit 6001ecc1 by Michael Meissner

Add Solaris support

From-SVN: r11875
parent c81bebd7
...@@ -5,9 +5,16 @@ ...@@ -5,9 +5,16 @@
#ifndef __GNUC_VA_LIST #ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST #define __GNUC_VA_LIST
#ifndef _SYS_VA_LIST_H
#define _SYS_VA_LIST_H /* Solaris sys/va_list.h */
/* Solaris decided to rename overflow_arg_area to input_arg_area,
so handle it via a macro. */
#define __va_overflow(AP) (AP)->overflow_arg_area
/* Note that the names in this structure are in the user's namespace, but /* Note that the names in this structure are in the user's namespace, but
that the V.4 abi explicitly states that these names should be used. */ that the V.4 abi explicitly states that these names should be used. */
typedef struct { typedef struct __va_list_tag {
char gpr; /* index into the array of 8 GPRs stored in the char gpr; /* index into the array of 8 GPRs stored in the
register save area gpr=0 corresponds to r3, register save area gpr=0 corresponds to r3,
gpr=1 to r4, etc. */ gpr=1 to r4, etc. */
...@@ -17,7 +24,14 @@ typedef struct { ...@@ -17,7 +24,14 @@ typedef struct {
char *overflow_arg_area; /* location on stack that holds the next char *overflow_arg_area; /* location on stack that holds the next
overflow argument */ overflow argument */
char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */ char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */
} __gnuc_va_list[1]; } __va_list[1], __gnuc_va_list[1];
#else /* _SYS_VA_LIST */
typedef __va_list __gnuc_va_list;
#define __va_overflow(AP) (AP)->input_arg_area
#endif /* not _SYS_VA_LIST */
#endif /* not __GNUC_VA_LIST */ #endif /* not __GNUC_VA_LIST */
/* If this is for internal libc use, don't define anything but /* If this is for internal libc use, don't define anything but
...@@ -64,9 +78,9 @@ __extension__ ({ \ ...@@ -64,9 +78,9 @@ __extension__ ({ \
(AP)->fpr = __va_fregno - 33; \ (AP)->fpr = __va_fregno - 33; \
(AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \ (AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \
+ __va_varargs_offset); \ + __va_varargs_offset); \
(AP)->overflow_arg_area = ((char *)__builtin_saveregs () \ __va_overflow(AP) = ((char *)__builtin_saveregs () \
+ (((__words >= 8) ? __words - 8 : 0) \ + (((__words >= 8) ? __words - 8 : 0) \
* sizeof (long))); \ * sizeof (long))); \
(void)0; \ (void)0; \
}) })
...@@ -129,22 +143,22 @@ __extension__ (*({ \ ...@@ -129,22 +143,22 @@ __extension__ (*({ \
&& (AP)->gpr < 8) \ && (AP)->gpr < 8) \
{ \ { \
(AP)->gpr = 8; \ (AP)->gpr = 8; \
__ptr = (TYPE *) (void *) ((AP)->overflow_arg_area); \ __ptr = (TYPE *) (void *) (__va_overflow(AP)); \
(AP)->overflow_arg_area += __va_size (TYPE) * sizeof (long); \ __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \
} \ } \
\ \
else if (__va_aggregate_p (TYPE)) \ else if (__va_aggregate_p (TYPE)) \
{ \ { \
__ptr = * (TYPE **) (void *) ((AP)->overflow_arg_area); \ __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \
(AP)->overflow_arg_area += sizeof (TYPE *); \ __va_overflow(AP) += sizeof (TYPE *); \
} \ } \
else \ else \
{ \ { \
if (__va_longlong_p(TYPE) && ((long)(AP)->overflow_arg_area & 4) != 0) \ if (__va_longlong_p(TYPE) && ((long)__va_overflow(AP) & 4) != 0) \
(AP)->overflow_arg_area += 4; \ __va_overflow(AP) += 4; \
\ \
__ptr = (TYPE *) (void *) ((AP)->overflow_arg_area); \ __ptr = (TYPE *) (void *) (__va_overflow(AP)); \
(AP)->overflow_arg_area += __va_size (TYPE) * sizeof (long); \ __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \
} \ } \
\ \
__ptr; \ __ptr; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment