From a1e3a1653a5772f6b4d119b0778e662ea3177026 Mon Sep 17 00:00:00 2001 From: "Seth R. Johnson" Date: Thu, 20 Feb 2020 13:00:48 -0500 Subject: Mark binutils-related conflicts (#15075) * Mark conflicts with binutils on darwin * Explicitly require binutils bootstrapping and mark conflict with nvptx * Disable gold variant by default on darwin --- .../repos/builtin/packages/binutils/package.py | 7 ++++++- var/spack/repos/builtin/packages/gcc/package.py | 22 +++++++++++++++------- var/spack/repos/builtin/packages/llvm/package.py | 3 ++- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py index ad5f7fb5ef..d84dd32bc5 100644 --- a/var/spack/repos/builtin/packages/binutils/package.py +++ b/var/spack/repos/builtin/packages/binutils/package.py @@ -5,6 +5,7 @@ from spack import * import glob +import sys class Binutils(AutotoolsPackage, GNUMirrorPackage): @@ -28,7 +29,8 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage): variant('plugins', default=False, description="enable plugins, needed for gold linker") - variant('gold', default=True, description="build the gold linker") + variant('gold', default=(sys.platform != 'darwin'), + description="build the gold linker") variant('libiberty', default=False, description='Also install libiberty.') variant('nls', default=True, description='Enable Native Language Support') variant('headers', default=False, description='Install extra headers (e.g. ELF)') @@ -44,6 +46,9 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage): depends_on('m4', type='build', when='@:2.29.99 +gold') depends_on('bison', type='build', when='@:2.29.99 +gold') + conflicts('+gold', when='platform=darwin', + msg="Binutils cannot build linkers on macOS") + def configure_args(self): spec = self.spec diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index 2c38296f11..431fcaa9da 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -187,6 +187,11 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): conflicts('languages=jit', when='+nvptx') conflicts('languages=objc', when='+nvptx') conflicts('languages=obj-c++', when='+nvptx') + # NVPTX build disables bootstrap + conflicts('+binutils', when='+nvptx') + + # Binutils can't build ld on macOS + conflicts('+binutils', when='platform=darwin') if sys.platform == 'darwin': # Fix parallel build on APFS filesystem @@ -298,17 +303,20 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage): # Binutils if spec.satisfies('+binutils'): - static_bootstrap_flags = '-static-libstdc++ -static-libgcc' + stage1_ldflags = str(self.rpath_args) + boot_ldflags = stage1_ldflags + ' -static-libstdc++ -static-libgcc' + if '%gcc' in spec: + stage1_ldflags = boot_ldflags + binutils = spec['binutils'].prefix.bin options.extend([ '--with-sysroot=/', - '--with-stage1-ldflags={0} {1}'.format( - self.rpath_args, static_bootstrap_flags), - '--with-boot-ldflags={0} {1}'.format( - self.rpath_args, static_bootstrap_flags), + '--with-stage1-ldflags=' + stage1_ldflags, + '--with-boot-ldflags=' + boot_ldflags, '--with-gnu-ld', - '--with-ld={0}/ld'.format(spec['binutils'].prefix.bin), + '--with-ld=' + binutils.ld, '--with-gnu-as', - '--with-as={0}/as'.format(spec['binutils'].prefix.bin), + '--with-as=' + binutils.join('as'), + '--enable-bootstrap', ]) # MPC diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 05e9404592..871559d453 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * +import sys class Llvm(CMakePackage): @@ -71,7 +72,7 @@ class Llvm(CMakePackage): description="Build the LLVM C++ standard library") variant('compiler-rt', default=True, description="Build LLVM compiler runtime, including sanitizers") - variant('gold', default=True, + variant('gold', default=(sys.platform != 'darwin'), description="Add support for LTO with the gold linker plugin") variant('shared_libs', default=False, description="Build all components as shared libraries, faster, " -- cgit v1.2.3-60-g2f50