Patchwork RISC-V: Add osabi support.

login
register
mail settings
Submitter Jim Wilson
Date July 4, 2018, 12:15 a.m.
Message ID <20180704001518.27593-1-jimw@sifive.com>
Download mbox | patch
Permalink /patch/28219/
State New
Headers show

Comments

Jim Wilson - July 4, 2018, 12:15 a.m.
This adds the osabi init call that the linux native port needs.

	gdb/
	* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
---
 gdb/riscv-tdep.c | 3 +++
 1 file changed, 3 insertions(+)
Andrew Burgess - July 4, 2018, 9:11 a.m.
* Jim Wilson <jimw@sifive.com> [2018-07-03 17:15:18 -0700]:

> This adds the osabi init call that the linux native port needs.
> 
> 	gdb/
> 	* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.

I'm happy with this patch, but again wonder if this should be part of
a sequence that adds OS support?

Thanks,
Andrewx

> ---
>  gdb/riscv-tdep.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index 154567136e..1b941eee55 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -2562,6 +2562,9 @@ riscv_gdbarch_init (struct gdbarch_info info,
>      user_reg_add (gdbarch, riscv_register_aliases[i].name,
>  		  value_of_riscv_user_reg, &riscv_register_aliases[i].regnum);
>  
> +  /* Hook in OS ABI-specific overrides, if they have been registered.  */
> +  gdbarch_init_osabi (info, gdbarch);
> +
>    return gdbarch;
>  }
>  
> -- 
> 2.17.1
>
John Baldwin - July 5, 2018, 10:25 p.m.
On 7/4/18 2:11 AM, Andrew Burgess wrote:
> * Jim Wilson <jimw@sifive.com> [2018-07-03 17:15:18 -0700]:
> 
>> This adds the osabi init call that the linux native port needs.
>>
>> 	gdb/
>> 	* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
> 
> I'm happy with this patch, but again wonder if this should be part of
> a sequence that adds OS support?

I would be happy to have these bits go in actually as I will probably start
working on FreeBSD RISC-V support in the near future (albeit using
QEMU as my test environment for now).  Having the riscv-tdep.c changes
upstream will make that easier rather than either duplicating that work
or having to temporarily pull it into my own branches.
Andrew Burgess - July 6, 2018, 9:39 p.m.
* John Baldwin <jhb@FreeBSD.org> [2018-07-05 15:25:54 -0700]:

> On 7/4/18 2:11 AM, Andrew Burgess wrote:
> > * Jim Wilson <jimw@sifive.com> [2018-07-03 17:15:18 -0700]:
> > 
> >> This adds the osabi init call that the linux native port needs.
> >>
> >> 	gdb/
> >> 	* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
> > 
> > I'm happy with this patch, but again wonder if this should be part of
> > a sequence that adds OS support?
> 
> I would be happy to have these bits go in actually as I will probably start
> working on FreeBSD RISC-V support in the near future (albeit using
> QEMU as my test environment for now).  Having the riscv-tdep.c changes
> upstream will make that easier rather than either duplicating that work
> or having to temporarily pull it into my own branches.

In terms of the code content of this patch (and the other one I
commented on) I'm perfectly happy.

However, I don't feel I'm qualified to give the OK to merge these
given the original push back against merging unused code.  I'd rather
a global maintainer say yes or no.

Thanks,
Andrew


> 
> -- 
> John Baldwin
Simon Marchi - July 7, 2018, 1:53 a.m.
On 2018-07-06 17:39, Andrew Burgess wrote:
> * John Baldwin <jhb@FreeBSD.org> [2018-07-05 15:25:54 -0700]:
> 
>> On 7/4/18 2:11 AM, Andrew Burgess wrote:
>> > * Jim Wilson <jimw@sifive.com> [2018-07-03 17:15:18 -0700]:
>> >
>> >> This adds the osabi init call that the linux native port needs.
>> >>
>> >> 	gdb/
>> >> 	* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
>> >
>> > I'm happy with this patch, but again wonder if this should be part of
>> > a sequence that adds OS support?
>> 
>> I would be happy to have these bits go in actually as I will probably 
>> start
>> working on FreeBSD RISC-V support in the near future (albeit using
>> QEMU as my test environment for now).  Having the riscv-tdep.c changes
>> upstream will make that easier rather than either duplicating that 
>> work
>> or having to temporarily pull it into my own branches.
> 
> In terms of the code content of this patch (and the other one I
> commented on) I'm perfectly happy.
> 
> However, I don't feel I'm qualified to give the OK to merge these
> given the original push back against merging unused code.  I'd rather
> a global maintainer say yes or no.

I think this is fine.  That line is kind of standard boilerplate in 
gdbarch_init methods.  The <arch>-tdep.c file is not really supposed to 
know what osabi variants exist above it, so it's ok to call it "just in 
case".  It's not like we are adding one thousand lines of not-yet-used 
code :).

Simon
Jim Wilson - July 16, 2018, 9:51 p.m.
On Fri, Jul 6, 2018 at 6:53 PM, Simon Marchi <simon.marchi@polymtl.ca> wrote:
>>> >> This adds the osabi init call that the linux native port needs.
>>> >>
>>> >>      gdb/
>>> >>      * riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.

This was approved by Andrew (RISC-V) and Simon (global) so I committed it.

Jim

Patch

diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 154567136e..1b941eee55 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2562,6 +2562,9 @@  riscv_gdbarch_init (struct gdbarch_info info,
     user_reg_add (gdbarch, riscv_register_aliases[i].name,
 		  value_of_riscv_user_reg, &riscv_register_aliases[i].regnum);
 
+  /* Hook in OS ABI-specific overrides, if they have been registered.  */
+  gdbarch_init_osabi (info, gdbarch);
+
   return gdbarch;
 }