diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2022-12-20 13:44:26 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2022-12-22 20:44:07 +0000 |
commit | 780d55199e54fafc3784691d5cf716c1bb92b0aa (patch) | |
tree | bc65d73e11f116734f2b2cab3dbd48d054b90c8d | |
parent | 24889135773204c6e3002dcb417c75ff1a99ccd0 (diff) |
gb_LTOFLAGS: use -flto=jobserver instead of fixed $(PARALLELISM)
fixed PARALLELISM causes explosion of jobs, especially when machines
wtih many cores/threads. A make wtih PARALLELISM=16 would launch up to
16 linker invocations that by themselves would also do their linking
with a parallelism of 16, causing load of over 100 and very likely
exhausting all memory bringing the system to a crawl or cause OOM kills.
for a command to be able to communicate with make's jobserver, it must
be part of a submake called with $(MAKE) or the command from the rule
needs to be prefixed with the + character.
While our gbuild stuff is a submake call, it only is that submake that
uses the PARALLELISM flags determined by configure, so that is not
sufficient for jobserver usage by the the lto linker.
Change-Id: I46ec4760c1a8623195700b8cb16f7deafeb1111e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144593
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | solenv/gbuild/platform/com_GCC_defs.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/platform/unxgcc.mk | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 7a2066a60a24..6eeda2fc03ab 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -197,8 +197,8 @@ ifeq (,$(index,iOS MACOSX,$(OS))) gb_LTOPLUGINFLAGS := --plugin $(if $(LD_PLUGIN),$(LD_PLUGIN),LLVMgold.so) endif else -# use first element of the PARALLELISM, to allow values like "12 -l 14" to specify load limits -gb_LTOFLAGS := -flto=$(if $(filter-out 0,$(PARALLELISM)),$(firstword $(PARALLELISM)),auto) -fuse-linker-plugin -O2 +# use parallelism based on make's job handling +gb_LTOFLAGS := -flto=jobserver -fuse-linker-plugin -O2 # clang does not support -flto=<number> gb_CLANG_LTOFLAGS := -flto=thin endif diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 5e971bd8944c..461d1f048390 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -134,7 +134,7 @@ $(if $(call gb_LinkTarget__WantLock,$2), \ $(gb_LinkTarget__cmd_lockfile) -r -1 $(gb_LinkTarget__Lock) ; \ echo "$(call gb_Output_announce_str,$(2): got link lock at $$(date -u),$(true),LNK,5)" ; \ ) - $(if $(filter EMSCRIPTEN,$(OS)),unset PYTHONWARNINGS ;) \ + +$(if $(filter EMSCRIPTEN,$(OS)),unset PYTHONWARNINGS ;) \ $(call gb_Helper_abbreviate_dirs,\ $(if $(call gb_LinkTarget__NeedsCxxLinker),$(or $(T_CXX),$(gb_CXX)) $(gb_CXX_LINKFLAGS),$(or $(T_CC),$(gb_CC))) \ $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ |