openfoam/wmake/rules/General/Gcc/link-c++
Mark Olesen 79993bba43 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
2023-12-15 16:17:12 +01:00

36 lines
939 B
Plaintext

#------------------------------------------------------------------------------
# Common linker settings
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared
LINKEXE = $(CC) $(c++FLAGS)
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
#------------------------------------------------------------------------------