Re: ARMv7 without VFP
Warner Losh <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.arm |
|---|---|
| Message-ID | <CANCZdfob9yjFdB3VkjgWRUpVMCqPWURRQGHCTLYiv-KoZ7E-UQ@mail.gmail.com> |
On Thu, Oct 8, 2020 at 5:57 PM Marcin Wojtas <[email protected]> wrote: > Hi, > > We have a CA9-based SoC that for some reason does not support the VFP > and would like to run the OS on stable/12. Disabling the VFP in the > kernel options (or adding the detection of the feature in runtime) > seems to work fine, but it turned out the biggest obstacle is trying > to force the userspace to use the softfloat libc callbacks (in theory > soft-/hard- float usage should be resolved dynamically by linking the > proper functions in libc - so far we found no way to compile it > successfully though with the standard toolchain). Other approaches to > hardcode the softfloat userspace have failed so far. Details can be > found below. > > Is there any known way to compile the userspace that may work with the > soft-float on armv7? > > Details: > When booting without VFP there is a problem with almost every process > receiving SIGILL signals. Core dumps and disassembly proved that the > illegal > instructions are associated with hardware FPU. The kernel seems to run > fine otherwise. > > 1. When building world with option CPUTYPE=soft, libc cannot be linked > properly > due to lack of _aeabi* > > --- all_subdir_sbin --- > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_f2iz_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fadd_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fcmpeq_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fcmpge_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fcmpgt_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fcmple_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fcmplt_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fcmpun_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fdiv_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fmul_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_fsub_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_i2f_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_d2f_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_d2iz_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_dadd_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_dcmpeq_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_dcmpge_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_dcmpgt_vfp > ld: error: > /usr/home/dgr/src/freebsd-src-obj/usr/home/dgr/src/src/stable12/arm.armv7/tmp/lib/libc.so.7: > undefined reference to __aeabi_dcmple_vfp > > 2. According to imp@, the softfloat system can still be built, however it > is not > officially supported anymore > ( > https://lists.freebsd.org/pipermail/freebsd-arch/2017-September/018329.html > ). > It is assumed that armv6/armv7 CPUs always have VFP unit. > > 3. FreeBSD stable/12 world with CPUTYPE=soft is built automatically with > -mfloat-abi=softfp, which emulates the soft float ABI, however still > uses hard float instructions. > > 4. When trying to pass -mfloat-abi=soft, everything is built with > three flags: -mfloat-abi=soft -mfloat-abi=softfp -mfloat-abi=softfp. > > 5. Additional problem encountered when trying to use additional flag > -mfloat-abi=soft: > > --- clang.full --- > > /home/mindal/obj/arm.armv6/usr/home/mindal/git/freebsd-src/lib/clang/libclang/libclang.a: > could not read symbols: File format not recognized > c++: error: linker command failed with exit code 1 (use -v to see > invocation) > > 6. Problems above seen on both stable/11 and stable/12. In case of > stable/12 > it is visible with both TARGET_ARCH=armv6 and TARGET_ARCH=armv7 > > I'd appreciate any feedback. > I last built this several clang generations ago. I fear that you'll need to chase down what might be a bug in clang. I'd give it a shot with an external toolchain based on gcc. There's been talk from time to time of adding a armv7sf target. If you make progress on the underlying problem, I'd be open to that. Warner > Best regards, > Marcin (mw@) > _______________________________________________ > [email protected] mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "[email protected]" > _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-arm To unsubscribe, send any mail to "[email protected]"