[Buildroot] [PATCH v2 1/1] package/go: add support for riscv64 architecture

Arnout Vandecappelle arnout at mind.be
Wed Apr 27 07:28:24 UTC 2022



On 27/04/2022 02:55, Christian Stewart wrote:
> Arnout,
> 
> On Thu, Apr 21, 2022 at 12:54 PM Arnout Vandecappelle <arnout at mind.be> wrote:
>> On 14/04/2022 22:49, Christian Stewart via buildroot wrote:
>>> +GOARCH is set when calling mkbuildcfg, so go1.4 is trying to compile riscv64.
>>
>>    You SoB is missing.
> 
> Go's repository disallows signed-off-by lines.
> 
>>    Also, the reference to the upstream PR is missing. And you should probably
>> refer to gerrit instead.
> 
> Same issue: I've format-patch the exact patch sent upstream, without changes.
> 
> Do I modify it specifically for this patch in Buildroot?

  Exactly. Alternatively, you can use GO_PATCH = ... to download the upstream 
patch (cfr. how it's done in zfs). In that case, you also need to add a hash for 
it. We currently don't use that method very often but I think it's a good one in 
fact.

>>> diff --git a/package/go/Config.in.host b/package/go/Config.in.host
>>> index e82ab6e81a..8be86103ea 100644
>>> --- a/package/go/Config.in.host
>>> +++ b/package/go/Config.in.host
>>> @@ -5,7 +5,7 @@ config BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
>>>        depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_ARCH_SUPPORTS
>>>        depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
>>>                || BR2_i386 || BR2_x86_64 || BR2_powerpc64le \
>>> -             || BR2_mips64 || BR2_mips64el || BR2_s390x
>>> +             || BR2_mips64 || BR2_mips64el || BR2_riscv || BR2_s390x
>>
>>    Here you enable it both for riscv32 and riscv64, but below you always set
>> GOARCH to riscv64.
> 
> I'm not sure if it was in this patch revision, but I have in my local version:
> 
>      # Go doesn't support Risc-v 32-bit.
>      depends on !BR2_RISCV_32

  That is indeed missing from this patch.


>> Also, are you sure it doesn't need any of the ISA extensions? I can imagine
>> that Go would be using atomics, floating point and integer
>> multiplication/division. Of course, there's almost no chance of finding a
>> riscv64 without these extensions, but better be correct, right?
> 
> Probably yes.

  Is there an easy way to find out, or should we just depend on all of them?


>>   Also, does Go support all three ABI types (integer, single precision and
>> double precision)? Again, we only ever test lp64d in the autobuilders, but
>> better be correct, right?
> 
> There's only one riscv64 target for Go so I have to assume it means lp64d.

  Please add that to the BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS dependencies.

  Regards,
  Arnout

> 
> Note: I have now tested this extensively on a Nezha Risc-v CPU as well
> as a Qemu VM.
> 
> https://github.com/skiffos/buildroot/blob/e1fc20cf9/package/go/Config.in.host#L12
> 
> Best,
> Christian Stewart



More information about the buildroot mailing list