[Libreoffice-commits] core.git: solenv/gbuild

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 10:57:42 UTC 2018


 solenv/gbuild/platform/macosx.mk |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

New commits:
commit ab9d95e6073d84a0dbabf1a4e704b8468afe7bff
Author:     Alyssa Ross <hi at alyssa.is>
AuthorDate: Mon Nov 26 01:07:42 2018 +0000
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Mon Nov 26 11:57:19 2018 +0100

    Use -filelist with macOS linker
    
    macOS's linker can take a -filelist argument, in place of taking the
    list of object files to link on the command line. This is a more limited
    version of "response files" as used elsewhere in the code base, and by
    using it we make it far less likely that a linker invocation will hit
    ARG_MAX.
    
    A standard LibreOffice build probably won't hit ARG_MAX on macOS just
    yet, but it's not far off - some LDFLAGS are enough to tip it over the
    edge, which is what prompted me to fix the issue. If not fixed, a few
    more object files will probably break LibreOffice builds on macOS! An
    example of another large program that has encountered this issue is
    Thunderbird, which implemented the same fix[1].
    
    The changes I've made to use -filelist are adapted from the code
    elsewhere in gbuild that creates response files, but this is slightly
    different because -filelist files are a bit different - they can only
    contain object files, as opposed to arbitrary linker arguments, and
    arguments are separated by newlines rather than spaces.
    
    [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=837618
    
    Change-Id: I01b9126aad95056c3dc82f941dea4fd43f95d0f2
    Reviewed-on: https://gerrit.libreoffice.org/64010
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index d51ce5887956..e9c2b485d4ec 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -101,13 +101,7 @@ endef
 
 define gb_LinkTarget__command_dynamiclink
 $(call gb_Helper_abbreviate_dirs,\
-	$(if $(CXXOBJECTS)$(OBJCXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \
-		$(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
-		$(if $(filter Bundle,$(TARGETTYPE)),$(gb_Bundle_TARGETTYPEFLAGS)) \
-		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
-		$(subst \d,$$,$(RPATH)) \
-		$(T_LDFLAGS) \
-		$(patsubst lib%.dylib,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \
+	FILELIST=$(call var2file,$(shell $(gb_MKTEMP)),100, \
 		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
 		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
 		$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
@@ -115,10 +109,21 @@ $(call gb_Helper_abbreviate_dirs,\
 		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
 		$(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
 		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
-		$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
+		$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist)))) && \
+	cat $${FILELIST} | sed 's/ /\$(NEWLINE)/g' | grep -v '^$$' > $${FILELIST}.1 && \
+	mv $${FILELIST}.1 $${FILELIST} && \
+	$(if $(CXXOBJECTS)$(OBJCXXOBJECTS)$(GENCXXOBJECTS)$(EXTRAOBJECTLISTS),$(gb_CXX),$(gb_CC)) \
+		$(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
+		$(if $(filter Bundle,$(TARGETTYPE)),$(gb_Bundle_TARGETTYPEFLAGS)) \
+		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
+		$(subst \d,$$,$(RPATH)) \
+		$(T_LDFLAGS) \
+		$(patsubst lib%.dylib,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \
+		-Wl$(COMMA)-filelist$(COMMA)$${FILELIST} \
 		$(T_LIBS) \
 		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
 		-o $(1) && \
+	rm -f $${FILELIST} && \
 	$(if $(SOVERSIONSCRIPT),ln -sf $(1) $(ILIBTARGET),:) && \
 	$(if $(filter Executable,$(TARGETTYPE)), \
 		$(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl app $(LAYER) $(1) &&) \


More information about the Libreoffice-commits mailing list