Index: sys/kern/kern_mib.c =================================================================== --- sys/kern/kern_mib.c +++ sys/kern/kern_mib.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include Index: sys/riscv/include/param.h =================================================================== --- sys/riscv/include/param.h +++ sys/riscv/include/param.h @@ -46,19 +46,17 @@ #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 #ifndef MAXCPU Index: sys/riscv/riscv/elf_machdep.c =================================================================== --- sys/riscv/riscv/elf_machdep.c +++ 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,9 +96,20 @@ .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, .machine = EM_RISCV,