Created attachment 188353 [details] v0 C and C++ code can be built targeting newer CPUs if user defined CPUTYPE in make.conf. Let's opt-in for Rust as well. For example, sysutils/exa built with CPUTYPE=core2 - http://sprunge.us/VKBj
(In reply to Jan Beich from comment #0) Can we not simply use CPUTYPE as is? I don't see why it has to depend on CFLAGS. Seems ok to me otherwise.
(In reply to Tobias Kortkamp from comment #1) > Can we not simply use CPUTYPE as is? bsd.cpu.mk accepts imaginary CPUTYPE values like "crusoe" or "k5" but doesn't like "native". Checking -march= also allows to respect NO_CPU_CFLAGS for free.
Personally, I'd prefer to purge bsd.cpu.mk out of existence, at least CPU whitelist logic. ;)
(In reply to Jan Beich from comment #2) > bsd.cpu.mk accepts imaginary CPUTYPE values like "crusoe" or "k5" but > doesn't like "native". Checking -march= also allows to respect > NO_CPU_CFLAGS for free. On aarch64 bsd.cpu.mk sets -mcpu= instead of -march= and then target-cpu is not being set. Is it a concern?
(In reply to Tobias Kortkamp from comment #4) Yes. I think, -mcpu= should be translated as well. $ clang50 -march=exynos-m1 test.c clang-5.0: error: the clang compiler does not support '-march=exynos-m1' $ clang50 -mcpu=exynos-m1 test.c $ $ gcc7 -march=exynos-m1 test.c cc1: error: unknown value 'exynos-m1' for -march $ gcc7 -mcpu=exynos-m1 test.c $ $ rustc -C target-cpu=exynos-m1 test.rs $
Created attachment 188386 [details] v1 On aarch64 rustc -C target-cpu= doesn't accept what clang -march= does. I guess, the same is true for armv6/armv7. sparc64 and powerpc* don't support -march= at all. I have no clue about mips* or riscv*. Let's fall back to -mcpu= and adjust in future if it breaks.
(In reply to Jan Beich from comment #6) Fine with me!
A commit references this bug: Author: tobik Date: Wed Nov 29 11:06:11 UTC 2017 New revision: 455101 URL: https://svnweb.freebsd.org/changeset/ports/455101 Log: Mk/Uses/cargo.mk: Respect CPUTYPE C and C++ code can be built targeting newer CPUs if user defined CPUTYPE in make.conf. Let's opt-in for Rust as well. PR: 223939 Submitted by: jbeich Changes: head/Mk/Uses/cargo.mk