Message ID | 4EFBCA88.7060801@gmail.com |
---|---|
State | New |
Headers | show |
On Wed, 2011-12-28 at 21:03 -0500, Patrick Marlier wrote: > With i386, the regparm(2) is not taken into account when there is a > variadic function. All parameters are in the stack. > Since this variable argument is never used removing it is not a problem. The ABI specifies beginTransaction as a variadic function, however. Even though we don't use that currently, there were reasons why we added that in the first place (e.g., to be able to add additional bits later on, including support for more codepaths). Is there another way we can fix this? Or is regparm in general undefined for variadic functions?
On 12/29/2011 06:59 AM, Torvald Riegel wrote: > On Wed, 2011-12-28 at 21:03 -0500, Patrick Marlier wrote: >> With i386, the regparm(2) is not taken into account when there is a >> variadic function. All parameters are in the stack. >> Since this variable argument is never used removing it is not a problem. > > The ABI specifies beginTransaction as a variadic function, however. > Even though we don't use that currently, there were reasons why we added > that in the first place (e.g., to be able to add additional bits later > on, including support for more codepaths). I am pretty sure this is a bug in the ABI. AFAIU in 32bits, a function cannot be variadic and satisfy regparm(2). > Is there another way we can fix this? Or is regparm in general > undefined for variadic functions? in i386.c (init_cumulative_args): ... if (!TARGET_64BIT) { /* If there are variable arguments, then we won't pass anything in registers in 32-bit mode. */ if (stdarg_p (fntype)) { cum->nregs = 0; cum->sse_nregs = 0; cum->mmx_nregs = 0; cum->warn_avx = 0; cum->warn_sse = 0; cum->warn_mmx = 0; return; } So I don't really see another way to fix it. Maybe Master Aldy or Master Richard? Patrick.
Index: libitm.h =================================================================== --- libitm.h (revision 182549) +++ libitm.h (working copy) @@ -136,7 +136,7 @@ typedef uint64_t _ITM_transactionId_t; /* Transact extern _ITM_transactionId_t _ITM_getTransactionId(void) ITM_REGPARM; -extern uint32_t _ITM_beginTransaction(uint32_t, ...) ITM_REGPARM; +extern uint32_t _ITM_beginTransaction(uint32_t) ITM_REGPARM; extern void _ITM_abortTransaction(_ITM_abortReason) ITM_REGPARM ITM_NORETURN;