* [RFA] mips_push_arguments: N32/N64 struct arguments
@ 2002-07-31 16:32 Kevin Buettner
2002-07-31 18:11 ` Michael Snyder
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Buettner @ 2002-07-31 16:32 UTC (permalink / raw)
To: gdb-patches
The patch below addresses some details in how N32 and N64 struct and
union arguments are passed. When using the SGI compiler, I'm seeing
the following failures fixed with this patch:
FAIL: gdb.base/call-ar-st.exp: print sum_array_print(10, *list1, *list2, *list3, *list4)
FAIL: gdb.base/call-ar-st.exp: print print_long_arg_list, pattern 12
For N32, this patch depends upon my previous patch:
[RFA] mips-tdep.c: Set mips_default_saved_regsize to 8 for N32
Okay to commit?
* mips-tdep.c (mips_push_arguments): For N32 and N64 ABIs, don't
write odd sized struct arguments living in registers to the stack.
For small struct and union arguments not living in registers,
don't shift the struct when writing to the stack.
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.85
diff -u -p -r1.85 mips-tdep.c
--- mips-tdep.c 31 Jul 2002 20:26:49 -0000 1.85
+++ mips-tdep.c 31 Jul 2002 23:07:27 -0000
@@ -2536,7 +2536,9 @@ mips_push_arguments (int nargs,
/* Write this portion of the argument to the stack. */
if (argreg > MIPS_LAST_ARG_REGNUM
- || odd_sized_struct
+ || (odd_sized_struct
+ && tdep->mips_abi != MIPS_ABI_N32
+ && tdep->mips_abi != MIPS_ABI_N64)
|| fp_register_arg_p (typecode, arg_type))
{
/* Should shorter than int integer values be
@@ -2552,8 +2554,10 @@ mips_push_arguments (int nargs,
typecode == TYPE_CODE_FLT) && len <= 4)
longword_offset = MIPS_STACK_ARGSIZE - len;
else if ((typecode == TYPE_CODE_STRUCT ||
- typecode == TYPE_CODE_UNION) &&
- TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE)
+ typecode == TYPE_CODE_UNION)
+ && TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE
+ && tdep->mips_abi != MIPS_ABI_N32
+ && tdep->mips_abi != MIPS_ABI_N64)
longword_offset = MIPS_STACK_ARGSIZE - len;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFA] mips_push_arguments: N32/N64 struct arguments
2002-07-31 16:32 [RFA] mips_push_arguments: N32/N64 struct arguments Kevin Buettner
@ 2002-07-31 18:11 ` Michael Snyder
0 siblings, 0 replies; 2+ messages in thread
From: Michael Snyder @ 2002-07-31 18:11 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
Kevin Buettner wrote:
>
> The patch below addresses some details in how N32 and N64 struct and
> union arguments are passed. When using the SGI compiler, I'm seeing
> the following failures fixed with this patch:
>
> FAIL: gdb.base/call-ar-st.exp: print sum_array_print(10, *list1, *list2, *list3, *list4)
> FAIL: gdb.base/call-ar-st.exp: print print_long_arg_list, pattern 12
>
> For N32, this patch depends upon my previous patch:
>
> [RFA] mips-tdep.c: Set mips_default_saved_regsize to 8 for N32
>
> Okay to commit?
Kevin,
I had already arrived at these same changes myself, but then
I seemed to have found that the REG_STRUCT_HAS_ADDR patch which
I just submitted rendered them unnecessary.
Could you try that patch, and meanwhile tell me which fails
these patches helped fix for you?
Michael
>
> * mips-tdep.c (mips_push_arguments): For N32 and N64 ABIs, don't
> write odd sized struct arguments living in registers to the stack.
> For small struct and union arguments not living in registers,
> don't shift the struct when writing to the stack.
>
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.85
> diff -u -p -r1.85 mips-tdep.c
> --- mips-tdep.c 31 Jul 2002 20:26:49 -0000 1.85
> +++ mips-tdep.c 31 Jul 2002 23:07:27 -0000
> @@ -2536,7 +2536,9 @@ mips_push_arguments (int nargs,
>
> /* Write this portion of the argument to the stack. */
> if (argreg > MIPS_LAST_ARG_REGNUM
> - || odd_sized_struct
> + || (odd_sized_struct
> + && tdep->mips_abi != MIPS_ABI_N32
> + && tdep->mips_abi != MIPS_ABI_N64)
> || fp_register_arg_p (typecode, arg_type))
> {
> /* Should shorter than int integer values be
> @@ -2552,8 +2554,10 @@ mips_push_arguments (int nargs,
> typecode == TYPE_CODE_FLT) && len <= 4)
> longword_offset = MIPS_STACK_ARGSIZE - len;
> else if ((typecode == TYPE_CODE_STRUCT ||
> - typecode == TYPE_CODE_UNION) &&
> - TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE)
> + typecode == TYPE_CODE_UNION)
> + && TYPE_LENGTH (arg_type) < MIPS_STACK_ARGSIZE
> + && tdep->mips_abi != MIPS_ABI_N32
> + && tdep->mips_abi != MIPS_ABI_N64)
> longword_offset = MIPS_STACK_ARGSIZE - len;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-31 23:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-31 16:32 [RFA] mips_push_arguments: N32/N64 struct arguments Kevin Buettner
2002-07-31 18:11 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox