solenv/gbuild/platform/freebsd.mk |    8 ++++++++
 solenv/inc/unxfbsdi.mk            |    8 ++++++++
 2 files changed, 16 insertions(+)

New commits:
commit 6a278b92d1822a0e7dfde8fd87d005f00a855e54
Author: Don Lewis <[email protected]>
Date:   Fri Apr 20 23:17:21 2018 +0000

    Work around a bug in clang versions 3.6.x and 3.7.x on 32-bit Intel.
    
    Using -Os optimization causes clang to generate bad DWARF CFI which
    is needed for stack unwinding during exception handling.  See:
    <https://llvm.org/bugs/show_bug.cgi?id=24792>
    Instead of using -Os, optimize using "-O2 -fno-unroll-loops" as a
    reasonably close substitute.

diff --git a/solenv/gbuild/platform/freebsd.mk 
b/solenv/gbuild/platform/freebsd.mk
index d519cb8c2386..5f4bc943186e 100644
--- a/solenv/gbuild/platform/freebsd.mk
+++ b/solenv/gbuild/platform/freebsd.mk
@@ -146,7 +146,15 @@ ifeq ($(gb_DEBUGLEVEL),2)
 gb_COMPILEROPTFLAGS := -O0
 gb_COMPILEROPT1FLAGS := -O0
 else
+# Clang versions 3.6.x and 3.7.x generate bad DWARF CFI for stack unwinding
+# on 32-bit Intel when compiling with -Os optimization.  See
+# <https://llvm.org/bugs/show_bug.cgi?id=24792>
+# Work around this by using "-O2 -fno-unroll-loops" instead.
+ifeq ($(COM)$(CPUNAME)$(shell expr $(CCNUMVER) '>=' 000300060000 '&' 
$(CCNUMVER) '<' 000300080000),CLANGINTEL1)
+gb_COMPILEROPTFLAGS := -O2 -fno-unroll-loops
+else
 gb_COMPILEROPTFLAGS := -Os
+endif
 gb_COMPILEROPT1FLAGS := -O1
 endif
 
diff --git a/solenv/inc/unxfbsdi.mk b/solenv/inc/unxfbsdi.mk
index 21703817605f..5d99f051c835 100644
--- a/solenv/inc/unxfbsdi.mk
+++ b/solenv/inc/unxfbsdi.mk
@@ -33,7 +33,15 @@ ARCH_FLAGS*=-mtune=pentiumpro
 
 # Compiler flags for enabling optimizations
 .IF "$(PRODUCT)"!=""
+# Clang versions 3.6.x and 3.7.x generate bad DWARF CFI for stack unwinding
+# on 32-bit Intel when compiling with -Os optimization.  See
+# <https://llvm.org/bugs/show_bug.cgi?id=24792>
+# Work around this by using "-O2 -fno-unroll-loops" instead.
+.IF "$(COM)"=="CLANG" && "$(CCNUMVER)">="000300060000" && 
"$(CCNUMVER)"<="000300079999"
+CFLAGSOPT=-O2 -fno-unroll-loops -fno-strict-aliasing   # optimizing for 
products
+.ELSE
 CFLAGSOPT=-Os -fno-strict-aliasing             # optimizing for products
+.ENDIF
 .ELSE  # "$(PRODUCT)"!=""
 CFLAGSOPT=                                     # no optimizing for non products
 .ENDIF # "$(PRODUCT)"!=""
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to