Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Jan 2018 06:52:08 +0100
From:      Jan Beich <jbeich@FreeBSD.org>
To:        toolchain@freebsd.org
Cc:        linimon@freebsd.org
Subject:   Is -march/-mtune=native actually supported on FreeBSD arm* or aarch64?
Message-ID:  <d12o-am47-wny@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Some ports pass -march=native and/or -mtune=native. Both are extensively
documented by GCC for x86. For other architectures some excerpts say
"native" is only supported on Linux (via /proc/cpuinfo). For example,

  $ uname -p
  armv6
  $ echo 'int main() {}' >a.c
  $ clang -march=native a.c
  clang: error: the clang compiler does not support '-march=native'
  $ clang -mtune=native a.c
  $ pkg install -qy gcc7
  $ gcc7 -march=native a.c
  $ gcc7 -mtune=native a.c

  $ uname -p
  aarch64
  $ echo 'int main() {}' >a.c
  $ clang -march=native a.c
  clang: error: the clang compiler does not support '-march=native'
  $ clang -mtune=native a.c
  clang: error: the clang compiler does not support '-mtune=native'
  $ pkg install -qy gcc7
  $ gcc7 -march=native a.c
  $ gcc7 -mtune=native a.c

What's the rationale for Clang vs. GCC difference? Is it safe to run
FreeBSD arm* -mtune=native binaries on CPUs older than build machine?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d12o-am47-wny>