diff mbox

gdb/riscv: Handle passing variadic floating point arguments

Message ID 20181205142958.27614-1-andrew.burgess@embecosm.com
State New
Headers show

Commit Message

Andrew Burgess Dec. 5, 2018, 2:29 p.m. UTC
This commit fixes some test failures in gdb.base/varargs.exp when
running on targets with floating point hardware.  Floating point
unnamed (variadic) arguments should be passed in integer registers
according to the abi.

After this commit I see no failures in gdb.base/varargs.exp on 32 or
64 bit targets with floating point hardware.

gdb/ChangeLog:

	* riscv-tdep.c (riscv_call_arg_scalar_float): Unnamed (variadic)
	arguments are passed in integer registers.
	(riscv_call_arg_complex_float): Likewise.
---
 gdb/ChangeLog    | 6 ++++++
 gdb/riscv-tdep.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Andrew Burgess Dec. 12, 2018, 2:24 p.m. UTC | #1
* Andrew Burgess <andrew.burgess@embecosm.com> [2018-12-05 14:29:58 +0000]:

> This commit fixes some test failures in gdb.base/varargs.exp when
> running on targets with floating point hardware.  Floating point
> unnamed (variadic) arguments should be passed in integer registers
> according to the abi.
> 
> After this commit I see no failures in gdb.base/varargs.exp on 32 or
> 64 bit targets with floating point hardware.
> 
> gdb/ChangeLog:
> 
> 	* riscv-tdep.c (riscv_call_arg_scalar_float): Unnamed (variadic)
> 	arguments are passed in integer registers.
> 	(riscv_call_arg_complex_float): Likewise.

I've now pushed this to master.

Thanks,
Andrew


> ---
>  gdb/ChangeLog    | 6 ++++++
>  gdb/riscv-tdep.c | 5 +++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index da4d61dc856..127cef66d36 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,9 @@
> +2018-12-05  Andrew Burgess  <andrew.burgess@embecosm.com>
> +
> +	* riscv-tdep.c (riscv_call_arg_scalar_float): Unnamed (variadic)
> +	arguments are passed in integer registers.
> +	(riscv_call_arg_complex_float): Likewise.
> +
>  2018-12-05  Andrew Burgess  <andrew.burgess@embecosm.com>
>  
>  	* riscv-tdep.c (riscv_features_from_gdbarch_info): New function.
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index d812b7c8693..fafb0d15d8a 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -1935,7 +1935,7 @@ static void
>  riscv_call_arg_scalar_float (struct riscv_arg_info *ainfo,
>  			     struct riscv_call_info *cinfo)
>  {
> -  if (ainfo->length > cinfo->flen)
> +  if (ainfo->length > cinfo->flen || ainfo->is_unnamed)
>      return riscv_call_arg_scalar_int (ainfo, cinfo);
>    else
>      {
> @@ -1955,7 +1955,8 @@ riscv_call_arg_complex_float (struct riscv_arg_info *ainfo,
>  			      struct riscv_call_info *cinfo)
>  {
>    if (ainfo->length <= (2 * cinfo->flen)
> -      && riscv_arg_regs_available (&cinfo->float_regs) >= 2)
> +      && riscv_arg_regs_available (&cinfo->float_regs) >= 2
> +      && !ainfo->is_unnamed)
>      {
>        bool result;
>        int len = ainfo->length / 2;
> -- 
> 2.14.5
>
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index da4d61dc856..127cef66d36 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@ 
+2018-12-05  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* riscv-tdep.c (riscv_call_arg_scalar_float): Unnamed (variadic)
+	arguments are passed in integer registers.
+	(riscv_call_arg_complex_float): Likewise.
+
 2018-12-05  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* riscv-tdep.c (riscv_features_from_gdbarch_info): New function.
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index d812b7c8693..fafb0d15d8a 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1935,7 +1935,7 @@  static void
 riscv_call_arg_scalar_float (struct riscv_arg_info *ainfo,
 			     struct riscv_call_info *cinfo)
 {
-  if (ainfo->length > cinfo->flen)
+  if (ainfo->length > cinfo->flen || ainfo->is_unnamed)
     return riscv_call_arg_scalar_int (ainfo, cinfo);
   else
     {
@@ -1955,7 +1955,8 @@  riscv_call_arg_complex_float (struct riscv_arg_info *ainfo,
 			      struct riscv_call_info *cinfo)
 {
   if (ainfo->length <= (2 * cinfo->flen)
-      && riscv_arg_regs_available (&cinfo->float_regs) >= 2)
+      && riscv_arg_regs_available (&cinfo->float_regs) >= 2
+      && !ainfo->is_unnamed)
     {
       bool result;
       int len = ainfo->length / 2;