From 8d4a5cb24743c8b7c1a2613cb619bc2fcba9311a Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 6 Jun 2022 05:46:43 -0700 Subject: [PATCH] GCC: add Apple M1 support (#30825) Co-authored-by: Seth R. Johnson --- var/spack/repos/builtin/packages/gcc/package.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index 9e8a080aec..cfa6d9446a 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -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.