[PATCH] D86621: [clang][Sparc] Default to -mcpu=v9 for SparcV8 on Solaris

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 02:43:13 PDT 2020


ro added a comment.

In D86621#2247791 <https://reviews.llvm.org/D86621#2247791>, @jrtc27 wrote:

> GCC on Linux defines `__sparc_v9__` even with `-m32`. I don't know what Solaris does but please don't break other operating systems just because Solaris has broken headers that conflate the CPU and the ABI.

I'd have sworn that I checked gcc on Linux/sparc64: must have been dreaming.

I quoted the relevant snippet of the Studio `cc(1)` man page which shows that Solaris compilers predefine `__sparcv8` for `-m32` and `__sparcv9` for `-m64`.  I'd argue that the creators of the CPU, the OS, and the initial compiler can decide to do so as they please (after all, AFAICT that's not part of any ABI and I couldn't find an API document that mentioned those), nothing broken or conflated here.

I've now looked at the GCC sources and found:

- FreeBSD/sparc64 is 64-bit-only, no 32-bit support in sight
- while the NetBSD/sparc64 port still includes bi-arch support, it is disabled because the don't ship a 32-bit environment and even if they did, they only define `__sparc_v9__` etc. for `-m64`.
- OpenBSD/sparc64 again is 64-bit only

I'll see how best to reconcile those.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86621/new/

https://reviews.llvm.org/D86621



More information about the cfe-commits mailing list