Skip to content

Commit

Permalink
Merge pull request easybuilders#2780 from boegel/riscv
Browse files Browse the repository at this point in the history
don't enable building of ld.gold when installing binutils on a RISC-V system + don't configure GCC to use gold as default linker on a RISC-V system
  • Loading branch information
branfosj authored Aug 31, 2022
2 parents 633ff25 + 1983c4d commit baea83c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
16 changes: 13 additions & 3 deletions easybuild/easyblocks/b/binutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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"""

Expand Down Expand Up @@ -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']:
Expand Down Expand Up @@ -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]
Expand Down
12 changes: 7 additions & 5 deletions easybuild/easyblocks/g/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit baea83c

Please sign in to comment.