On 18 Nov, j...@apache.org wrote:
> Author: jim
> Date: Sat Nov 18 22:24:42 2017
> New Revision: 1815700
> 
> URL: http://svn.apache.org/viewvc?rev=1815700&view=rev
> Log:
> Force compilation with -O1 flag instead of -O2
> 
> Modified:
>     openoffice/trunk/main/framework/Library_fwk.mk
> 
> Modified: openoffice/trunk/main/framework/Library_fwk.mk
> URL: 
> http://svn.apache.org/viewvc/openoffice/trunk/main/framework/Library_fwk.mk?rev=1815700&r1=1815699&r2=1815700&view=diff
> ==============================================================================
> --- openoffice/trunk/main/framework/Library_fwk.mk (original)
> +++ openoffice/trunk/main/framework/Library_fwk.mk Sat Nov 18 22:24:42 2017
> @@ -61,6 +61,10 @@ $(eval $(call gb_Library_add_linked_libs
>       $(gb_STDLIBS) \
>  ))
>  
> +ifeq ($(OS),MACOSX)
> +gb_COMPILEROPTFLAGS := -O1
> +endif
> +
>  $(eval $(call gb_Library_add_exception_objects,fwk,\
>       framework/source/accelerators/acceleratorcache \
>       framework/source/accelerators/acceleratorconfiguration \
> 
> 

I'd like to propose the patch below as an alternative:
 * FreeBSD 10 / amd64 also has this problem.  It just depends on the
   machine architecture and clang version.

 * The patch below only changes the optimization for one file, not
   everything in this library.

 * Hardwiring -O1 does the wrong thing for debug builds, which want to
   totally disable optimization so that the values of variables are not
   optimized out.

Admittedly this patch is a bit ugly because gbuild doesn't currently
have a way to set target-specific optimization flags.  The problem is
that it passes $(gb_COMPILEROPTFLAGS) as a function call argument, which
is evaluated globally and not in a target-specific context.  This should
be fixable.

What does 'cc --version' report on the Mac for the different releases
that work / don't work properly?  I'd like to bring $(CCNUMVER) to
gbuild so that these sorts of tweaks are only enabled for the compiler
versions that need it.

--- framework/Library_fwk.mk.orig       2017-10-11 11:40:20 UTC
+++ framework/Library_fwk.mk
@@ -186,4 +186,11 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\
        framework/source/xml/imagesdocumenthandler \
 ))
 
+# i126622 - Base 4.1.2 does not open Tables and Queries in Mac OSX
+# Also affects FreeBSD 10.3 with clang 3.4.1.
+# Appears to be a clang optimization bug in versions less than 3.8.0
+ifeq ($(COM)$(CPUNAME),CLANGX86_64)
+$(call gb_CxxObject_get_target,framework/source/loadenv/loadenv):      
CXXFLAGS := $(gb_LinkTarget_CXXFLAGS) $(gb_LinkTarget_EXCEPTIONFLAGS) 
$(gb_COMPILERNOOPTFLAGS)
+endif
+
 # vim: set noet sw=4 ts=4:


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

Reply via email to