svn commit: r358247 - in head/sys: conf riscv/include

Warner Losh imp at bsdimp.com
Sat Feb 22 15:26:53 UTC 2020


On Sat, Feb 22, 2020 at 7:51 AM Warner Losh <imp at bsdimp.com> wrote:

>
>
> On Sat, Feb 22, 2020, 6:23 AM Kristof Provost <kp at freebsd.org> wrote:
>
>> Author: kp
>> Date: Sat Feb 22 13:23:27 2020
>> New Revision: 358247
>> URL: https://svnweb.freebsd.org/changeset/base/358247
>>
>> Log:
>>   riscv: Set MACHINE_ARCH correctly
>>
>>   MACHINE_ARCH sets the hw.machine_arch sysctl in the kernel. In userspace
>>   it sets MACHINE_ARCH in bmake, which bsd.cpu.mk uses to configure the
>>   target ABI for ports.
>>
>>   For riscv64sf builds (i.e. soft-float) that needs to be riscv64sf, but
>>   the sysctl didn't reflect that. It is static.
>>
>>   Set the define from the riscv makefile so that we correctly reflect our
>>   actual build (i.e. riscv64 or riscv64sf), depending on what TARGET_ARCH
>>   we were built with.
>>
>>   That still doesn't satisfy userspace builds (e.g. bmake), so check if
>>   we're building with a software-floating point toolchain there. That
>>   check doesn't work in the kernel, because it never uses floating point.
>>
>>   Reviewed by:  philip (previous version), mhorne
>>   Sponsored by: Axiado
>>   Differential Revision:        https://reviews.freebsd.org/D23741
>>
>> Modified:
>>   head/sys/conf/Makefile.riscv
>>   head/sys/riscv/include/param.h
>>
>> Modified: head/sys/conf/Makefile.riscv
>>
>> ==============================================================================
>> --- head/sys/conf/Makefile.riscv        Sat Feb 22 12:10:41 2020
>> (r358246)
>> +++ head/sys/conf/Makefile.riscv        Sat Feb 22 13:23:27 2020
>> (r358247)
>> @@ -46,6 +46,8 @@ SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T $
>>  CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
>>  .endif
>>
>> +CFLAGS += -DMACHINE_ARCH=\"${TARGET_ARCH}\"
>>
>
> This is bogus. It should be removed. TARGET_ARCH may not be defined here
> and Makefile.inc1 should already set it for cross builds. Please remove it.
>

Err, I mean use MACHINE_ARCH. I suspect the real right answer here is to
get the arch right so that the test you use in param.h is right. But if
not, then you gotta use MACHINE_ARCH here.

Warner


>
> Warnet
>
>
> +
>>  # hack because genassym.c includes sys/bus.h which includes these.
>>  genassym.o: bus_if.h device_if.h
>>
>>
>> Modified: head/sys/riscv/include/param.h
>>
>> ==============================================================================
>> --- head/sys/riscv/include/param.h      Sat Feb 22 12:10:41 2020
>> (r358246)
>> +++ head/sys/riscv/include/param.h      Sat Feb 22 13:23:27 2020
>> (r358247)
>> @@ -46,7 +46,11 @@
>>  #define        MACHINE         "riscv"
>>  #endif
>>  #ifndef MACHINE_ARCH
>> +#ifdef __riscv_float_abi_soft
>> +#define        MACHINE_ARCH    "riscv64sf"
>> +#else
>>  #define        MACHINE_ARCH    "riscv64"
>> +#endif
>>  #endif
>>
>>  #ifdef SMP
>>
>


More information about the svn-src-head mailing list