From nobody Sun Sep 24 17:46:35 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rttjd54Nlz4vFYj for ; Sun, 24 Sep 2023 17:46:45 +0000 (UTC) (envelope-from sergeantsagara@protonmail.com) Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "protonmail.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rttjd1P1Cz3Ysf for ; Sun, 24 Sep 2023 17:46:45 +0000 (UTC) (envelope-from sergeantsagara@protonmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b="WTid/Ezo"; spf=pass (mx1.freebsd.org: domain of sergeantsagara@protonmail.com designates 185.70.43.16 as permitted sender) smtp.mailfrom=sergeantsagara@protonmail.com; dmarc=pass (policy=quarantine) header.from=protonmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1695577602; x=1695836802; bh=uWue/WJtKUbTxp5bfM0hdS3qDS7IAH1bfaM3z/UeNAg=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=WTid/Ezo9NY2I1AR1BPHJzmyUEh2glk5Y3phJE0iijM5UHNqqTon/mwODwwjiJrX9 pOmA1JMDaykSq3YGHkcUUuAViy2OifKPSDRfv4iX0Ipqq6z6Udfi19jh5/xfNLghuf GbgDFQyX/g4r4WI3T9CjXf6pJZFxYAYBf/85/3wXZ1ZfKZEh01aTy6coMMwXcQH/ca jbbGMBbbrrEogXeQWEEu0xCTKAkUswU60iGuUNp5z9XTlDZUzVhxzgSa9EsqsKl0U5 zusJnXJ45E7Ecx0iQR1xMesq3E1niD5IqwQ1TGQg+1f/OOiYknd8+v1hR8K46l/pDF E1m4LkBAKYoiQ== Date: Sun, 24 Sep 2023 17:46:35 +0000 To: freebsd-arm@FreeBSD.org From: Rahul Rameshbabu Cc: Rahul Rameshbabu Subject: FreeBSD aarch64 buildworld target fails to build 32-bit compat LLVM compiler-rt due to fp support Message-ID: <87h6njh3ba.fsf@protonmail.com> Feedback-ID: 26003777:user:proton List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.71 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[protonmail.com,quarantine]; RWL_MAILSPIKE_EXCELLENT(-0.40)[185.70.43.16:from]; NEURAL_HAM_SHORT(-0.31)[-0.314]; R_DKIM_ALLOW(-0.20)[protonmail.com:s=protonmail3]; R_SPF_ALLOW(-0.20)[+ip4:185.70.43.0/24:c]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_ENVFROM(0.00)[protonmail.com]; MLMMJ_DEST(0.00)[freebsd-arm@FreeBSD.org]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:62371, ipnet:185.70.43.0/24, country:CH]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[protonmail.com:+]; FREEMAIL_CC(0.00)[protonmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FREEMAIL_FROM(0.00)[protonmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4Rttjd1P1Cz3Ysf Hello, I am trying to build the FreeBSD project for aarch64 to better support the Raspberry Pi 3 and Raspberry Pi 4 boards in the project. https://wiki.freebsd.org/arm/Raspberry%20Pi I use the following build command (generic aarch64 target). make TARGET_ARCH=3Daarch64 SRCCONF=3D/dev/null __MAKE_CONF=3D/dev/null -j= 32 buildworld I notice the following error related to HW floating point support on armv7 (32-bit arch) target that is compiled for compat/32-bit build purpose= s. --- fixunsdfsivfp.o --- /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/fixunsdfsivfp.= S:26:2: error: instruction requires: fp registers --- lshrdi3.o --- cc -march=3Darmv7 -m32 -target armv7-unknown-freebsd15.0-gnueabihf -DCOM= PAT_LIBCOMPAT=3D\"32\" -DCOMPAT_libcompat=3D\"32\" -DCOMPAT_LIB32 --sysr= oot=3D/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/t= mp -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/t= mp/usr/bin -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aa= rch64/tmp/usr/lib32 -O2 -pipe -fno-common -target armv7-unknown-freebsd -= fpic -fvisibility=3Dhidden -DVISIBILITY_HIDDEN -I/usr/src/contrib/llvm-proj= ect/libunwind/include -DEMIT_SYNC_ATOMICS -g -gz=3Dzlib -MD -MF.depend.lsh= rdi3.o -MTlshrdi3.o -std=3Dgnu99 -Wno-format-zero-length -Wsystem-headers -= Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wdate-ti= me -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-err= or=3Dunused-but-set-parameter -Wno-tautological-compare -Wno-unused-value -= Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unu= sed-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-sw--- fixu= nsdfsivfp.o --- vmov d7, r0, r1 ^ /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/fixunsdfsivfp.= S:27:2: error: instruction requires: double precision VFP VFP2 vcvt.u32.f64 s15, d7 ^ /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/fixunsdfsivfp.= S:28:2: error: instruction requires: fp registers vmov r0, s15 ^ --- lshrti3.o --- --- lshrdi3.o --- itch-enum -Wno-knr-promoted-parameter -Qunused-arguments -c /usr/src/= contrib/llvm-project/compiler-rt/lib/builtins/lshrdi3.c -o lshrdi3.o --- fixunssfsivfp.o --- /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/fixunssfsivfp.= S:26:2: error: instruction requires: fp registers vmov s15, r0 ^ /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/fixunssfsivfp.= S:27:2: error: instruction requires: VFP2 vcvt.u32.f32 s15, s15 ^ /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/fixunssfsivfp.= S:28:2: error: instruction requires: fp registers vmov r0, s15 ^ --- moddi3.o --- --- modsi3.o --- --- lshrti3.o --- cc -march=3Darmv7 -m32 -target armv7-unknown-freebsd15.0-gnueabihf -DCOM= PAT_LIBCOMPAT=3D\"32\" -DCOMPAT_libcompat=3D\"32\" -DCOMPAT_LIB32 --sysr= oot=3D/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/t= mp -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/t= mp/usr/bin -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aa= rch64/tmp/usr/lib32 -O2 -pipe -fno-common -target armv7-unknown-freebsd -= fpic -fvisibility=3Dhidden -DVISIBILITY_HIDDEN -I/usr/src/contrib/llvm-proj= ect/libunwind/include -DEMIT_SYNC_ATOMICS -g -gz=3Dzlib -MD -MF.depend.lsh= rti3.o -MTlshrti3.o -std=3Dgnu99 -Wno-format-zero-length -Wsystem-headers -= Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wdate-ti= me -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-err= or=3Dunused-but-set-parameter -Wno-tautological-compare -Wno-unused-value -= Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unu= sed-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-sw--- modd= i3.o --- cc -march=3Darmv7 -m32 -target armv7-unknown-freebsd15.0-gnueabihf -DCOM= PAT_LIBCOMPAT=3D\"32\" -DCOMPAT_libcompat=3D\"32\" -DCOMPAT_LIB32 --sysr= oot=3D/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/t= mp -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/t= mp/usr/bin -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aa= rch64/tmp/usr/lib32 -O2 -pipe -fno-common -target armv7-unknown-freebsd -= fpic -fvisibility=3Dhidden -DVISIBILITY_HIDDEN -I/usr/src/contrib/llvm-proj= ect/libunwind/include -DEMIT_SYNC_ATOMICS -g -gz=3Dzlib -MD -MF.depend.mod= di3.o -MTmoddi3.o -std=3Dgnu99 -Wno-format-zero-length -Wsystem-headers -We= rror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wdate-time= -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error= =3Dunused-but-set-parameter -Wno-tautological-compare -Wno-unused-value -Wn= o-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unuse= d-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-swit--- lshr= ti3.o --- itch-enum -Wno-knr-promoted-parameter -Qunused-arguments -c /usr/src/= contrib/llvm-project/compiler-rt/lib/builtins/lshrti3.c -o lshrti3.o --- modsi3.o --- cc -march=3Darmv7 -m32 -target armv7-unknown-freebsd15.0-gnueabihf -DCOMP= AT_LIBCOMPAT=3D\"32\" -DCOMPAT_libcompat=3D\"32\" -DCOMPAT_LIB32 --sysroot= =3D/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/tmp = -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch64/tmp/u= sr/bin -B/home/binary-eater/Documents/crochet/work/obj/usr/src/arm64.aarch6= 4/tmp/usr/lib32 -O2 -pipe -fno-common -target armv7-unknown-freebsd -fpic = -fvisibility=3Dhidden -DVISIBILITY_HIDDEN -I/usr/src/contrib/llvm-project/l= ibunwind/include -DEMIT_SYNC_ATOMICS -g -gz=3Dzlib -MD -MF.depend.modsi3.o= -MTmodsi3.o -std=3Dgnu99 -Wno-format-zero-length -Wsystem-headers -Werror = -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wdate-time -Wno= -empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=3Dun= used-but-set-parameter -Wno-tautological-compare -Wno-unused-value -Wno-par= entheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-loc= al-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enu--- mod= di3.o --- ch-enum -Wno-knr-promoted-parameter -Qunused-arguments -c /usr/src/co= ntrib/llvm-project/compiler-rt/lib/builtins/moddi3.c -o moddi3.o --- modsi3.o --- m -Wno-knr-promoted-parameter -Qunused-arguments -target armv7-unkno= wn-freebsd -c /usr/src/contrib/llvm-project/compiler-rt/lib/builtins/arm/= modsi3.S -o modsi3.o --- fixunsdfsivfp.o --- *** [fixunsdfsivfp.o] Error code 1 make[4]: stopped in /usr/src/lib/libcompiler_rt --- fixunssfsivfp.o --- *** [fixunssfsivfp.o] Error code 1 make[4]: stopped in /usr/src/lib/libcompiler_rt 2 errors make[4]: stopped in /usr/src/lib/libcompiler_rt make[3]: stopped in /usr/src --- lib/libgcc_eh__PL --- make[3]: stopped in /usr/src make[2]: stopped in /usr/src 0.31 real 2.27 user 0.81 sys *** [build32] Error code 2 make[1]: stopped in /usr/src 1 error make[1]: stopped in /usr/src make: stopped in /usr/src I believe this is due to a couple of parts in the build system where I am not sure what the right solution would be. In lib/libcompiler_rt/Makefile.inc: .for file in ${SRCF} .if ${MACHINE_CPUARCH} =3D=3D "arm" && (!defined(CPUTYPE) || ${CPUTYPE:M*= soft*} =3D=3D "") \ && exists(${CRTSRC}/${CRTARCH}/${file}vfp.S) SRCS+=3D=09=09${file}vfp.S . elif exists(${CRTSRC}/${CRTARCH}/${file}.S) SRCS+=3D=09=09${file}.S . else SRCS+=3D=09=09${file}.c . endif .endfor When 32-bit compat for aarch64 is compiled, the first conditional is true and this leads to the vfp assembly variants under contrib/llvm-project/compiler-rt/lib/builtins/arm being chosen as source that needs to be assembled (but the compiler options seem to lack the needed arguments for the specific fp register support needed for vfp). I believe these options are determined by the following snippet in share/mk/bsd.compat.mk. .elif ${COMPAT_ARCH} =3D=3D "aarch64" HAS_COMPAT+=3D=0932 .if empty(LIB32CPUTYPE) LIB32CPUFLAGS=3D=09-march=3Darmv7 .else LIB32CPUFLAGS=3D=09-mcpu=3D${LIB32CPUTYPE} .endif The problem here is that armv7 is selected for the arch but there is no indication of vfp support, which leads to the error seen. I am not sure what the ideal fix is (avoid using vfp built-in for 32-bit compat or hack up the compat build to indicate 32-bit compat for aarch64 always has HW fp support). You can find the full logs here if needed. https://gist.github.com/Binary-Eater/1ced3c02530254e716c441ed77ce4d8c -- Thanks, Rahul Rameshbabu