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
This commit is contained in:
Seth R. Johnson 2020-02-20 13:00:48 -05:00 committed by GitHub
parent f5b5036ad5
commit a1e3a1653a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 9 deletions

View file

@ -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

View file

@ -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 @@ def configure_args(self):
# 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

View file

@ -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, "