GCC: add Apple M1 support (#30825)

Co-authored-by: Seth R. Johnson <johnsonsr@ornl.gov>
This commit is contained in:
Adam J. Stewart 2022-06-06 05:46:43 -07:00 committed by GitHub
parent bf2d44c87e
commit 8d4a5cb247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -256,8 +256,8 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
conflicts('+bootstrap', when='@:11.1 %apple-clang@12.0.5')
# aarch64/M1 is supported in GCC 12+
conflicts('@:11', when='target=aarch64: platform=darwin',
msg='Only GCC 12 and newer support macOS M1 (aarch64)')
conflicts('@:11.2,11.3.1:', when='target=aarch64: platform=darwin',
msg='Only GCC 11.3.0 supports macOS M1 (aarch64)')
# Newer binutils than RHEL's is required to run `as` on some instructions
# generated by new GCC (see https://github.com/spack/spack/issues/12235)
@ -292,6 +292,12 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
patch('https://github.com/iains/gcc-darwin-arm64/commit/20f61faaed3b335d792e38892d826054d2ac9f15.patch?full_index=1',
sha256='c0605179a856ca046d093c13cea4d2e024809ec2ad4bf3708543fc3d2e60504b', when='@11.2.0')
# Apple M1 support, created from branch of Darwin maintainer for GCC:
# https://github.com/iains/gcc-11-branch
patch('https://raw.githubusercontent.com/Homebrew/formula-patches/22dec3fc/gcc/gcc-11.3.0-arm.diff',
sha256='e02006b7ec917cc1390645d95735a6a866caed0dfe506d5bef742f7862cab218',
when='@11.3.0 target=aarch64:')
# Use -headerpad_max_install_names in the build,
# otherwise updated load commands won't fit in the Mach-O header.
# This is needed because `gcc` avoids the superenv shim.