CONFIG: support explicit selection of 'ld' linker
- for clang-based compilers the default linker may be lld or simply ld. Support '+link-ld' to explicitly select use of the ld linker. - consolidate linker rules into single files STYLE: adjust SPDX Identifier
This commit is contained in:
parent
5cdc8c6fde
commit
79993bba43
@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
exec "@PROJECT_DIR@"/etc/openfoam "$@"
|
||||
#------------------------------------------------------------------------------
|
||||
# OpenFOAM file (www.openfoam.com)
|
||||
# This file is part of OpenFOAM (www.openfoam.com)
|
||||
#
|
||||
# Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
# SPDX-License-Identifier: (GPL-3.0+)
|
||||
# SPDX-License-Identifier: (GPL-3.0-or-later)
|
||||
#
|
||||
# Description
|
||||
# Forward to OpenFOAM etc/openfoam bash session script.
|
||||
|
11
etc/bashrc
11
etc/bashrc
@ -83,9 +83,10 @@ export WM_LABEL_SIZE=32
|
||||
export WM_COMPILE_OPTION=Opt
|
||||
|
||||
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
|
||||
# +gold : with gold linker
|
||||
# +lld : with lld linker (with clang)
|
||||
# +mold : with mold linker (with clang)
|
||||
# +gold : use gold linker
|
||||
# +link-ld: use ld linker [clang]
|
||||
# +lld : use lld linker [clang]
|
||||
# +mold : use mold linker [clang]
|
||||
# ~libz : without libz compression
|
||||
# ~rpath : without rpath handling [MacOS]
|
||||
# +openmp : with openmp
|
||||
@ -94,8 +95,8 @@ export WM_COMPILE_OPTION=Opt
|
||||
# +xcrun : use xcrun and native compilers [MacOS]
|
||||
# +strict : more deprecation warnings (may generate *many* warnings)
|
||||
# ccache=... : ccache command (unquoted, single/double or <> quoted)
|
||||
# version=... : compiler suffix (eg, "11" for gcc-11)
|
||||
#export WM_COMPILE_CONTROL="+gold"
|
||||
# version=... : compiler suffix (eg, version=11 -> gcc-11)
|
||||
#export WM_COMPILE_CONTROL="+strict"
|
||||
|
||||
# [WM_MPLIB] - MPI implementation:
|
||||
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
|
||||
|
11
etc/cshrc
11
etc/cshrc
@ -83,9 +83,10 @@ setenv WM_LABEL_SIZE 32
|
||||
setenv WM_COMPILE_OPTION Opt
|
||||
|
||||
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
|
||||
# +gold : with gold linker
|
||||
# +lld : with lld linker (with clang)
|
||||
# +mold : with mold linker (with clang)
|
||||
# +gold : use gold linker
|
||||
# +link-ld: use ld linker [clang]
|
||||
# +lld : use lld linker [clang]
|
||||
# +mold : use mold linker [clang]
|
||||
# ~libz : without libz compression
|
||||
# ~rpath : without rpath handling [MacOS]
|
||||
# +openmp : with openmp
|
||||
@ -94,8 +95,8 @@ setenv WM_COMPILE_OPTION Opt
|
||||
# +xcrun : use xcrun and native compilers [MacOS]
|
||||
# +strict : more deprecation warnings (may generate *many* warnings)
|
||||
# ccache=... : ccache command (unquoted, single/double or <> quoted)
|
||||
# version=... : compiler suffix (eg, "11" for gcc-11)
|
||||
#setenv WM_COMPILE_CONTROL "+gold"
|
||||
# version=... : compiler suffix (eg, version=11 -> gcc-11)
|
||||
#setenv WM_COMPILE_CONTROL "+strict"
|
||||
|
||||
# [WM_MPLIB] - MPI implementation:
|
||||
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
|
||||
|
@ -8,7 +8,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# SPDX-License-Identifier: (GPL-3.0+)
|
||||
# SPDX-License-Identifier: (GPL-3.0-or-later)
|
||||
#
|
||||
# Script
|
||||
# list-modules
|
||||
|
@ -6,6 +6,7 @@ LINKLIBSO = $(CC) $(c++FLAGS) -shared
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS)
|
||||
|
||||
# ---------------
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
|
@ -1,10 +1,54 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Common linker settings
|
||||
|
||||
LINK_LIBS = $(c++DBUG)
|
||||
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared
|
||||
LINKEXE = $(CC) $(c++FLAGS)
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS) \
|
||||
-Xlinker --add-needed
|
||||
undefine LINKEXE_STUB
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Use gold linker
|
||||
ifneq (,$(findstring +gold,$(WM_COMPILE_CONTROL)))
|
||||
|
||||
LINKLIBSO += -fuse-ld=gold
|
||||
LINKEXE += -fuse-ld=gold
|
||||
LINKEXE_STUB := true
|
||||
|
||||
# Use mold linker
|
||||
else ifneq (,$(findstring +mold,$(WM_COMPILE_CONTROL)))
|
||||
|
||||
LINKLIBSO += -fuse-ld=mold
|
||||
LINKEXE += -fuse-ld=mold
|
||||
LINKEXE_STUB := true
|
||||
|
||||
# Use lld linker
|
||||
else ifneq (,$(findstring +lld,$(WM_COMPILE_CONTROL)))
|
||||
|
||||
LINKLIBSO += -fuse-ld=lld
|
||||
LINKEXE += -fuse-ld=lld
|
||||
LINKEXE_STUB := true
|
||||
|
||||
# Use ld linker - no dummy stub ('+link-ld' not '+ld' to avoid false matches)
|
||||
else ifneq (,$(findstring +link-ld,$(WM_COMPILE_CONTROL)))
|
||||
|
||||
LINKLIBSO += -fuse-ld=ld
|
||||
LINKEXE += -fuse-ld=ld -Xlinker --add-needed
|
||||
|
||||
# Default linker, assume ld - no dummy stub
|
||||
else
|
||||
|
||||
LINKEXE += -Xlinker --add-needed
|
||||
|
||||
endif
|
||||
|
||||
# ---------------
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(LINKEXE_STUB))
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -1,16 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
LINK_LIBS = $(c++DBUG)
|
||||
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
|
||||
-fuse-ld=gold
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS) \
|
||||
-fuse-ld=gold
|
||||
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -1,16 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
LINK_LIBS = $(c++DBUG)
|
||||
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
|
||||
-fuse-ld=lld
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS) \
|
||||
-fuse-ld=lld
|
||||
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -1,16 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
LINK_LIBS = $(c++DBUG)
|
||||
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
|
||||
-fuse-ld=mold
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS) \
|
||||
-fuse-ld=mold
|
||||
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -1,13 +1,35 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Common linker settings
|
||||
|
||||
LINK_LIBS = $(c++DBUG)
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared
|
||||
LINKEXE = $(CC) $(c++FLAGS)
|
||||
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
|
||||
-Xlinker --add-needed \
|
||||
-Xlinker --no-as-needed
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS) \
|
||||
-Xlinker --add-needed \
|
||||
-Xlinker --no-as-needed
|
||||
undefine LINKEXE_STUB
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Use gold linker
|
||||
ifneq (,$(findstring +gold,$(WM_COMPILE_CONTROL)))
|
||||
|
||||
LINKLIBSO += -fuse-ld=gold
|
||||
LINKEXE += -fuse-ld=gold
|
||||
LINKEXE_STUB := true
|
||||
|
||||
# Default linker, assume ld - no dummy stub
|
||||
else
|
||||
|
||||
LINKLIBSO += -Xlinker --add-needed -Xlinker --no-as-needed
|
||||
LINKEXE += -Xlinker --add-needed -Xlinker --no-as-needed
|
||||
|
||||
endif
|
||||
|
||||
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(LINKEXE_STUB))
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -1,16 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
LINK_LIBS = $(c++DBUG)
|
||||
|
||||
LINKLIBSO = $(CC) $(c++FLAGS) -shared \
|
||||
-fuse-ld=gold
|
||||
|
||||
LINKEXE = $(CC) $(c++FLAGS) \
|
||||
-fuse-ld=gold
|
||||
|
||||
# Link dummy stub to resolve libPstream symbols used by libOpenFOAM
|
||||
ifneq (,$(findstring -lOpenFOAM,$(PROJECT_LIBS)))
|
||||
LINKEXE += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -16,19 +16,6 @@ cctoo = $(Ctoo)
|
||||
cpptoo = $(Ctoo)
|
||||
cxxtoo = $(Ctoo)
|
||||
|
||||
# Linking:
|
||||
|
||||
ifneq (,$(findstring +gold,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Clang/link-gold-c++
|
||||
|
||||
else ifneq (,$(findstring +mold,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Clang/link-mold-c++
|
||||
|
||||
else ifneq (,$(findstring +lld,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Clang/link-lld-c++
|
||||
|
||||
else
|
||||
include $(GENERAL_RULES)/Clang/link-c++
|
||||
endif
|
||||
include $(GENERAL_RULES)/Clang/link-c++
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -16,10 +16,6 @@ cctoo = $(Ctoo)
|
||||
cpptoo = $(Ctoo)
|
||||
cxxtoo = $(Ctoo)
|
||||
|
||||
ifneq (,$(findstring +gold,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Gcc/link-gold-c++
|
||||
else
|
||||
include $(GENERAL_RULES)/Gcc/link-c++
|
||||
endif
|
||||
include $(GENERAL_RULES)/Gcc/link-c++
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -16,19 +16,6 @@ cctoo = $(Ctoo)
|
||||
cpptoo = $(Ctoo)
|
||||
cxxtoo = $(Ctoo)
|
||||
|
||||
# Linking:
|
||||
|
||||
ifneq (,$(findstring +gold,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Clang/link-gold-c++
|
||||
|
||||
else ifneq (,$(findstring +mold,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Clang/link-mold-c++
|
||||
|
||||
else ifneq (,$(findstring +lld,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Clang/link-lld-c++
|
||||
|
||||
else
|
||||
include $(GENERAL_RULES)/Clang/link-c++
|
||||
endif
|
||||
include $(GENERAL_RULES)/Clang/link-c++
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -16,10 +16,6 @@ cctoo = $(Ctoo)
|
||||
cpptoo = $(Ctoo)
|
||||
cxxtoo = $(Ctoo)
|
||||
|
||||
ifneq (,$(findstring +gold,$(WM_COMPILE_CONTROL)))
|
||||
include $(GENERAL_RULES)/Gcc/link-gold-c++
|
||||
else
|
||||
include $(GENERAL_RULES)/Gcc/link-c++
|
||||
endif
|
||||
include $(GENERAL_RULES)/Gcc/link-c++
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user