diff --git a/easybuild/easyblocks/b/binutils.py b/easybuild/easyblocks/b/binutils.py index 40213b1ca4..6bc27f5413 100644 --- a/easybuild/easyblocks/b/binutils.py +++ b/easybuild/easyblocks/b/binutils.py @@ -39,7 +39,7 @@ from easybuild.tools.filetools import apply_regex_substitutions, copy_file from easybuild.tools.modules import get_software_libdir, get_software_root from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import get_shared_lib_ext +from easybuild.tools.systemtools import RISCV, get_cpu_family, get_shared_lib_ext from easybuild.tools.utilities import nub @@ -56,6 +56,13 @@ def extra_options(extra_vars=None): }) return extra_vars + def __init__(self, *args, **kwargs): + """Easyblock constructor""" + super(EB_binutils, self).__init__(*args, **kwargs) + + # ld.gold linker is not supported on RISC-V + self.use_gold = get_cpu_family() != RISCV + def determine_used_library_paths(self): """Check which paths are used to search for libraries""" @@ -158,7 +165,9 @@ def configure_step(self): # enable gold linker with plugin support, use ld as default linker (for recent versions of binutils) if LooseVersion(self.version) > LooseVersion('2.24'): - self.cfg.update('configopts', "--enable-gold --enable-plugins --enable-ld=default") + self.cfg.update('configopts', "--enable-plugins --enable-ld=default") + if self.use_gold: + self.cfg.update('configopts', '--enable-gold') if LooseVersion(self.version) >= LooseVersion('2.34'): if self.cfg['use_debuginfod']: @@ -221,8 +230,9 @@ def sanity_check_step(self): shlib_ext = get_shared_lib_ext() if LooseVersion(self.version) > LooseVersion('2.24'): - binaries.append('ld.gold') lib_exts.append(shlib_ext) + if self.use_gold: + binaries.append('ld.gold') bin_paths = [os.path.join('bin', b) for b in binaries] inc_paths = [os.path.join('include', h) for h in headers] diff --git a/easybuild/easyblocks/g/gcc.py b/easybuild/easyblocks/g/gcc.py index 3983fc1a62..dbe1039c54 100644 --- a/easybuild/easyblocks/g/gcc.py +++ b/easybuild/easyblocks/g/gcc.py @@ -51,8 +51,8 @@ from easybuild.tools.filetools import which, write_file from easybuild.tools.modules import get_software_root from easybuild.tools.run import run_cmd -from easybuild.tools.systemtools import check_os_dependency, get_os_name, get_os_type -from easybuild.tools.systemtools import get_cpu_architecture, get_gcc_version, get_shared_lib_ext +from easybuild.tools.systemtools import RISCV, check_os_dependency, get_cpu_architecture, get_cpu_family +from easybuild.tools.systemtools import get_gcc_version, get_shared_lib_ext, get_os_name, get_os_type from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC from easybuild.tools.utilities import nub @@ -90,7 +90,7 @@ def extra_options(): 'prefer_lib_subdir': [False, "Configure GCC to prefer 'lib' subdirs over 'lib64' when linking", CUSTOM], 'profiled': [False, "Bootstrap GCC with profile-guided optimizations", CUSTOM], 'use_gold_linker': [None, "Configure GCC to use GOLD as default linker " - "(default: True for GCC < 11.3.0)", CUSTOM], + "(default: enable automatically for GCC < 11.3.0, except on RISC-V)", CUSTOM], 'withcloog': [False, "Build GCC with CLooG support", CUSTOM], 'withisl': [False, "Build GCC with ISL support", CUSTOM], 'withlibiberty': [False, "Enable installing of libiberty", CUSTOM], @@ -526,8 +526,10 @@ def configure_step(self): # enable plugin support self.configopts += " --enable-plugins " - # use GOLD as default linker - if self.cfg['use_gold_linker']: + # use GOLD as default linker, except on RISC-V (since it's not supported there) + if get_cpu_family() == RISCV: + self.configopts += " --disable-gold --enable-ld=default" + elif self.cfg['use_gold_linker']: self.configopts += " --enable-gold=default --enable-ld --with-plugin-ld=ld.gold" else: self.configopts += " --enable-gold --enable-ld=default"