RISC-V: Support for FreeBSD

Message ID CA+yXCZBH4s5e4-TA2T8JeKztfE-8sAH_d7JnsyYrkh0p5TMx5w@mail.gmail.com
State New
Headers show
Series
  • RISC-V: Support for FreeBSD
Related show

Commit Message

Kito Cheng Jan. 29, 2018, 3:34 a.m.
Hi all:

This patch enable RISC-V support FreeBSD, Ruslan (RISC-V FreeBSD
maintainer) and me has been tested on FreeBSD 12 for building kernel
and whole user space programs/libraries.

Comments

Nick Clifton Jan. 29, 2018, 2:08 p.m. | #1
Hi Kito,

> This patch enable RISC-V support FreeBSD, Ruslan (RISC-V FreeBSD

> maintainer) and me has been tested on FreeBSD 12 for building kernel

> and whole user space programs/libraries.


Does this actually work ?
 
>    riscv*-*-*)			fmt=elf endian=little ;;

> +  riscv*-*-freebsd*)			fmt=elf endian=little em=freebsd ;;

 
To me it looks like the first line will match "riscv-freebsd" as well,
and since it has precedence the freebsd emulation parameter will not be
set.

Cheers
  Nick
Jim Wilson Jan. 29, 2018, 7:31 p.m. | #2
On 01/29/2018 06:08 AM, Nick Clifton wrote:
> Hi Kito,

> 

>> This patch enable RISC-V support FreeBSD, Ruslan (RISC-V FreeBSD

>> maintainer) and me has been tested on FreeBSD 12 for building kernel

>> and whole user space programs/libraries.

> 

> Does this actually work ?

>   

>>     riscv*-*-*)			fmt=elf endian=little ;;

>> +  riscv*-*-freebsd*)			fmt=elf endian=little em=freebsd ;;

>   

> To me it looks like the first line will match "riscv-freebsd" as well,

> and since it has precedence the freebsd emulation parameter will not be

> set.


It does not work, for precisely the reason you mentioned.

It also appears pointless, as the only difference between te-generic.h 
and te-freebsd.h is the define of TE_FreeBSD in the latter, but that is 
not used anywhere in the RISC-V port.  So maybe that is why it "works", 
because it is unnecessary.  But that also means it is harmless and won't 
break anything if it goes in, with the order fixed of course.

I also don't see a copyright assignment for Ruslan.  This is probably OK 
as a trivial patches, but if there are more patches coming we would need 
a copyright assignment.

Jim
Kito Cheng Jan. 30, 2018, 2:45 a.m. | #3
Hi Nick:


> Does this actually work ?

Yes, it's work, I guess it's just because like Jim said, however
Ruslan and me will update and test it again, thanks!

Hi Jim:

Thanks your comment, I will fix the order and try again.


On Tue, Jan 30, 2018 at 3:31 AM, Jim Wilson <jimw@sifive.com> wrote:
> On 01/29/2018 06:08 AM, Nick Clifton wrote:

>>

>> Hi Kito,

>>

>>> This patch enable RISC-V support FreeBSD, Ruslan (RISC-V FreeBSD

>>> maintainer) and me has been tested on FreeBSD 12 for building kernel

>>> and whole user space programs/libraries.

>>

>>

>> Does this actually work ?

>>

>>>

>>>     riscv*-*-*)                 fmt=elf endian=little ;;

>>> +  riscv*-*-freebsd*)                   fmt=elf endian=little em=freebsd

>>> ;;

>>

>>   To me it looks like the first line will match "riscv-freebsd" as well,

>> and since it has precedence the freebsd emulation parameter will not be

>> set.

>

>

> It does not work, for precisely the reason you mentioned.

>

> It also appears pointless, as the only difference between te-generic.h and

> te-freebsd.h is the define of TE_FreeBSD in the latter, but that is not used

> anywhere in the RISC-V port.  So maybe that is why it "works", because it is

> unnecessary.  But that also means it is harmless and won't break anything if

> it goes in, with the order fixed of course.

>

> I also don't see a copyright assignment for Ruslan.  This is probably OK as

> a trivial patches, but if there are more patches coming we would need a

> copyright assignment.

>

> Jim

>

> --

> You received this message because you are subscribed to the Google Groups

> "RISC-V Patches" group.

> To unsubscribe from this group and stop receiving emails from it, send an

> email to patches+unsubscribe@groups.riscv.org.

> To post to this group, send email to patches@groups.riscv.org.

> Visit this group at

> https://groups.google.com/a/groups.riscv.org/group/patches/.

> To view this discussion on the web visit

> https://groups.google.com/a/groups.riscv.org/d/msgid/patches/09c0a5ac-39f3-ca6d-43aa-2d7951a28911%40sifive.com.

>

> For more options, visit

> https://groups.google.com/a/groups.riscv.org/d/optout.

Patch

From 66a63991e7bcb9ef306fc449c8f15ca232f2045d Mon Sep 17 00:00:00 2001
From: Ruslan Bukin <br@bsdpad.com>
Date: Wed, 3 Jan 2018 15:03:55 +0000
Subject: [PATCH] RISC-V: Add support for FreeBSD

---
 gas/configure.tgt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gas/configure.tgt b/gas/configure.tgt
index 9d5e781..401c937 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -401,6 +401,7 @@  case ${generic_target} in
   pru-*-*)				fmt=elf ;;
 
   riscv*-*-*)				fmt=elf endian=little ;;
+  riscv*-*-freebsd*)			fmt=elf endian=little em=freebsd ;;
 
   s390-*-linux-*)			fmt=elf em=linux ;;
   s390-*-tpf*)				fmt=elf ;;
-- 
2.7.4