Index: head/sys/kern/kern_mib.c =================================================================== --- head/sys/kern/kern_mib.c +++ head/sys/kern/kern_mib.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include Index: head/sys/riscv/include/param.h =================================================================== --- head/sys/riscv/include/param.h +++ head/sys/riscv/include/param.h @@ -46,18 +46,16 @@ #define MACHINE "riscv" #endif #ifndef MACHINE_ARCH -/* - * Check to see if we're building with hardware floating instructions - * allowed. We check this instead of hard vs soft float ABI because we build the - * kernel with soft float ABI to avoid hard float instruction generation. If - * we ever allow a 'soft ABI but with hard floats' userland, then we'll need - * to rethink this. - */ -#ifdef __riscv_flen -#define MACHINE_ARCH "riscv64" -#else + +/* Always use the hard-float arch for the kernel. */ +#if !defined(_KERNEL) && defined(__riscv_float_abi_soft) #define MACHINE_ARCH "riscv64sf" +#else +#define MACHINE_ARCH "riscv64" #endif +#endif +#ifdef _KERNEL +#define MACHINE_ARCHES "riscv64 riscv64sf" #endif #ifdef SMP Index: head/sys/riscv/riscv/elf_machdep.c =================================================================== --- head/sys/riscv/riscv/elf_machdep.c +++ head/sys/riscv/riscv/elf_machdep.c @@ -58,6 +58,8 @@ #include #include +static const char *riscv_machine_arch(struct proc *p); + u_long elf_hwcap; struct sysentvec elf64_freebsd_sysvec = { @@ -94,8 +96,19 @@ .sv_thread_detach = NULL, .sv_trap = NULL, .sv_hwcap = &elf_hwcap, + .sv_machine_arch = riscv_machine_arch, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); + +static const char * +riscv_machine_arch(struct proc *p) +{ + + if ((p->p_elf_flags & EF_RISCV_FLOAT_ABI_MASK) == + EF_RISCV_FLOAT_ABI_SOFT) + return (MACHINE_ARCH "sf"); + return (MACHINE_ARCH); +} static Elf64_Brandinfo freebsd_brand_info = { .brand = ELFOSABI_FREEBSD,