From owner-freebsd-arm@freebsd.org Fri Oct 9 04:19:34 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8D02438A9B for ; Fri, 9 Oct 2020 04:19:34 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C6vwj6rlBz3bWS for ; Fri, 9 Oct 2020 04:19:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id c2so9336337qkf.10 for ; Thu, 08 Oct 2020 21:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0a92OruEQ/lXfXqiwsyisesXbiHgcWGZOuaJRWWLUoo=; b=wVIMxNZ8EunnGhYYKUqk61tN3coHT/VC0PrsV3YzoVIco3WFO5weG1BwhtGFsnvGOZ 5heQSd5lv5b0KPAYOrQeibAltqHjD/whUXqS85gF1HjLUYiEgUI0f/btCsfMz/sv0mfA QGNnojMtdrHv1bHHdDr1R/uI0mVpfadVddurt1QPWK9hVvfS1vLf7KI9Gm06yETaiI9N VDIf5/NYmt6CtCLeUq1RfZNnNgfKOhocJeZZ/h/EBH2YkvLQdHicWuuAYubR6iG17+wa CrM3tD0Zu2WR57HVStXHcgIaIteaY8y2diJlCjvZpxr64wXel2RqR+wRwE+aXlVqVmXQ Xs5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0a92OruEQ/lXfXqiwsyisesXbiHgcWGZOuaJRWWLUoo=; b=S8Lf/+R06XE6Avskm/DwQ1FqfMQyI3U4rl9n1dVORKpzk5bMC5oc63HFdBpPUiWvUP D7E3neZM2//Zy/71LlJ32PbAdHckRhwQlnOhaB/Hbx2HihXIggZV0+x1j7zCff2iUpqs DAU/lmeHkJp85jdWutPWFU2rde2x3IMxvzi+fJK6RvRWlO5U0GyUrgs+K0RgOQ4eimfe 6lj8jmCdPmo0nv9BSOrUyI+2vyW1SDH02OucQMDLha2GeY8I7xYP5VQv/+KC1yB85W6Q EQCgb14X/WttTo9aPj8o1IgijOspBrUcBL9x5fNoVDtkcH+XQhiyUErcoyqz5ddbtsfc fXrw== X-Gm-Message-State: AOAM530jDPy8+DKsfQRIlIw6c5U+uFLv9KWWJyu9rmUwNIHY9n/5G8Ja S1DJqa7qvftuN3/Am0OurMwH9zPFzR444W2nOnVfCkYy2conmg== X-Google-Smtp-Source: ABdhPJyipRirUYoCyfieMZ1Hkkqp9blQAdPzYUDOpNXcxuTucwNM0XeIAcYEjp4RtKD3K3jKcuci7UPhO4cBziTJmUs= X-Received: by 2002:ae9:eb97:: with SMTP id b145mr4289234qkg.60.1602217172727; Thu, 08 Oct 2020 21:19:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Thu, 8 Oct 2020 22:19:21 -0600 Message-ID: Subject: Re: ARMv7 without VFP To: Marcin Wojtas Cc: freebsd-arm X-Rspamd-Queue-Id: 4C6vwj6rlBz3bWS X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=wVIMxNZ8; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.03 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-0.98)[-0.983]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.02)[-1.020]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::729:from]; NEURAL_HAM_SHORT(-0.03)[-0.026]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[freebsd-arm]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2020 04:19:35 -0000 On Thu, Oct 8, 2020 at 5:57 PM Marcin Wojtas 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@) > _______________________________________________ > freebsd-arm@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org" >