solenv/gbuild/platform/com_GCC_defs.mk |    4 ++--
 solenv/gbuild/platform/unxgcc.mk       |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 780d55199e54fafc3784691d5cf716c1bb92b0aa
Author:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
AuthorDate: Tue Dec 20 13:44:26 2022 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Thu Dec 22 20:44:07 2022 +0000

    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+libreoff...@googlemail.com>

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)) \

Reply via email to