Setting CPUFLAGS breaks aarch64 13.2 -> 14.0 cross compile due to invalid -mcpu=
Date: Sun, 19 Nov 2023 18:59:40 UTC
I have been building 13.2 with the following line in /etc/make.conf: CPUTYPE?=armv8a+aes+crc+sha2 This matches my processor (Ampere eMAG), which llvm does not know by name. Now I want to upgrade to 14.0. I can't build from source on 13.2. Compiling 32 bit objects fails because $CPUTYPE is not valid for armv7. Setting CPUTYPE_32?=armv7 does not work either. That generates an invalid compiler option -mcpu=armv7. Setting CPUTYPE=armv7 needs to generate only -march=armv7 and not -mcpu=armv7. The make infrastructure generates both. Using an empty string for CPUTYPE_32 did not work either. According to /usr/share/examples/etc/make.conf, I should be able to use CPUTYPE=armv7. Is this supposed to work? Is there a /etc/make.conf variable that sets -march= but not -mcpu=? # Meta data file /usr/obj/usr/src/arm64.aarch64/libexec/rtld-elf32/crtbrand.o.meta CMD cc -target aarch64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/arm64.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-common -march=armv8a+aes+crc+sha2 -mcpu=armv8a+aes+crc+sha2 -m32 -target armv7-unknown-freebsd14.0-gnueabihf -DCOMPAT_LIBCOMPAT=\"32\" -DCOMPAT_libcompat=\"32\" -DCOMPAT_LIB32 --sysroot=/usr/obj/usr/src/arm64.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/lib32 -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding -I/usr/src/lib/csu/common -I/usr/src/libexec/rtld-elf/arm -I/usr/src/libexec/rtld-elf -fpic -DPIC -I/usr/src/libexec/rtld-elf/rtld-libc -mfpu=none -g -gz=zlib -std=gnu99 -Wno-format-zero-length -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wformat=2 -Wno-format-extra-args -Werror -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Qunused-arguments -DLOCORE -c /usr/src/lib/csu/common/crtbrand.S -o crtbrand.o CMD CWD /usr/obj/usr/src/arm64.aarch64/libexec/rtld-elf32 TARGET crtbrand.o OODATE /usr/src/lib/csu/common/crtbrand.S -- command output -- clang: error: unsupported argument 'armv8a+aes+crc+sha2' to option '-mcpu=' clang: error: ignoring extension 'sha2' because the 'invalid' architecture does not support it [-Werror,-Winvalid-command-line-argument] clang: error: ignoring extension 'aes' because the 'invalid' architecture does not support it [-Werror,-Winvalid-command-line-argument] clang: error: unsupported argument 'armv8a+aes+crc+sha2' to option '-mcpu=' clang: error: ignoring extension 'sha2' because the 'invalid' architecture does not support it [-Werror,-Winvalid-command-line-argument] clang: error: ignoring extension 'aes' because the 'invalid' architecture does not support it [-Werror,-Winvalid-command-line-argument]