[SCM] LibreOffice packaging repository branch, master, updated. libreoffice_3.5.2-1-6-g5e762af
The following commit has been merged in the master branch:
commit 5e762affd45ba1a009b40c73fd43eec1369f7cc7
Author: Rene Engelhard <rene@debian.org>
Date: Fri Apr 6 16:13:38 2012 +0200
"backport gcc 4.7 build and runtime(!) fixes for i386/amd64 from master; build-conflict against gcc >= 4.7~
diff --git a/changelog b/changelog
index 8d3b643..36cae8c 100644
--- a/changelog
+++ b/changelog
@@ -1,5 +1,8 @@
libreoffice (1:3.5.2-2) UNRELEASED; urgency=low
+ * debian/patches/gcc-4.7{,-i386.-amd64}.diff: backport gcc 4.7 build and
+ runtime(!) fixes for i386/amd64 from master
+
* debian/shell-lib-extensions.sh, debian/*bug-script.in:
use --bundled instead of --shared; that's what we do and without bundled
we don't get the info with unopkg list
@@ -10,8 +13,11 @@ libreoffice (1:3.5.2-2) UNRELEASED; urgency=low
* debian/rules, debian/control.in, debian/*.triggers.in,
debian/scripts/gid2pkgdirs.sh: split script-provider-for-python out of
python(3)-uno out to libreoffice-script-provider-python where it belongs
+ * debian/control.in:
+ - build-conflict against
+ gcc (>= 4.7~) [!i386 !amd64], g++ (>= 4.7~) [!i386 !amd64]
- -- Rene Engelhard <rene@debian.org> Thu, 05 Apr 2012 14:24:22 +0200
+ -- Rene Engelhard <rene@debian.org> Fri, 06 Apr 2012 16:02:58 +0200
libreoffice (1:3.5.2-1) unstable; urgency=low
diff --git a/control b/control
index a6ede96..8a1c14d 100644
--- a/control
+++ b/control
@@ -5,7 +5,7 @@ Maintainer: Debian LibreOffice Maintainers <debian-openoffice@lists.debian.org>
Uploaders: Rene Engelhard <rene@debian.org>
Build-Depends: dpkg-dev (>= 1.16.1), lsb-release, bzip2, bison, flex | flex-old, libxaw7-dev, unzip, zip, autoconf, automake, sharutils, pkg-config, libfontconfig1-dev, libc0.1 (>= 2.10.2-7) [kfreebsd-i386 kfreebsd-amd64], zlib1g-dev, libfreetype6-dev, libx11-dev, libsm-dev, libxt-dev, libxext-dev, libxtst-dev, libice-dev, libcups2-dev, libarchive-zip-perl, fastjar, xsltproc, libxkbfile-dev, libxinerama-dev, x11proto-render-dev, libxml-parser-perl, gperf, po-debconf, bc, wget | curl, gcc-4.7 [hppa kfreebsd-i386 kfreebsd-amd64], g++-4.7 [hppa kfreebsd-i386 kfreebsd-amd64], libgl1-mesa-dev [!armel !mips !mipsel], libglu1-mesa-dev [!armel !mips !mipsel], libpoppler-dev (>= 0.8.0), libpoppler-private-dev, libpoppler-cpp-dev, libgraphite2-dev (>= 0.9.3) [!alpha !armel !sparc], libexttextcat-dev (>= 3.1.1), libjpeg-dev, libxml2-dev, libxslt1-dev, libexpat1-dev, unixodbc-dev (>= 2.2.11), libsane-dev, libxrender-dev, libpng12-dev, libssl-dev, librsvg2-dev, libdb-dev, python (>= 2.6.
6-3+squeeze4), python-dev (>= 2.6), python3-dev, debhelper (>= 7.2.3~), libcppunit-dev (>= 1.12), junit4 (>= 4.8.2-2), openjdk-6-jdk (>= 6b23~pre8-2) [alpha amd64 armel armhf i386 mips mipsel powerpc powerpcspe ppc64 s390 s390x sparc], openjdk-7-jdk [ia64], gcj-jdk [hppa kfreebsd-i386 kfreebsd-amd64], gcj-native-helper [hppa kfreebsd-amd64 kfreebsd-i386], libgcj-common (>= 1:4.4.1) [hppa kfreebsd-amd64 kfreebsd-i386], ant (>= 1.7.0), ant-optional (>= 1.7.0), mingw-w64 (>= 1.0), libcommons-codec-java, libcommons-httpclient-java, libcommons-lang-java, libcommons-logging-java (>= 1.1.1-9), libservlet2.5-java, libbase-java [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libsac-java [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libxml-java (>= 1.1.6) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libflute-java (>= 1.1.6) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreeb
sd-amd64 !kfreebsd-i386], libpentaho-reporting-flow-engine-java (>= 0.9.4) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], liblayout-java (>= 0.2.10) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libloader-java (>= 1.1.6) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libformula-java (>= 1.1.7) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], librepository-java (>= 1.1.6) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libfonts-java (>= 1.1.6) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libserializer-java (>= 1.1.6) [!armel !armhf !hppa !powerpc !powerpcspe !ppc64 !kfreebsd-amd64 !kfreebsd-i386], libcommons-logging-java (>= 1.1.1-9), libservlet2.5-java, javahelper (>= 0.37~), libnss3-dev (>= 3.12.3), xulrunner-dev [!s390x], dmake (>= 1:4.11), libhunspell-dev (>= 1.1.5-
2), libhyphen-dev (>= 2.4), libstlport4.6-dev (>= 4.6.2-3) [i386], libboost-dev (>= 1.38), libmdds-dev (>= 0.5.0), libvigraimpex-dev, libsampleicc-dev, libicc-utils-dev, libwpd-dev (>= 0.9.0), libmythes-dev (>= 2:1.2), libwps-dev (>= 0.2.0), libwpg-dev (>= 0.2.0), libvisio-dev, libcmis-dev, libicu-dev (>= 4.0), libcairo2-dev, kdelibs5-dev (>= 4:4.3.4), libqt4-dev (>= 4.5), libmysqlclient-dev, libmysqlcppconn-dev (>= 1.1.0~r791), libgtk2.0-dev (>= 2.10), libgtk-3-dev (>= 3.2~), libebook1.2-dev [!armel !armhf !powerpc !powerpcspe !ppc64], libpq-dev (>= 9.0~), libxrandr-dev, liblucene2-java (>= 2.3.2), libhsqldb-java (>> 1.8.0.10), bsh (>= 2.0b4), liblpsolve55-dev (>= 5.5.0.13-5+b1), lp-solve (>= 5.5.0.13-5+b1), libsuitesparse-dev (>= 1:3.4.0), libdbus-glib-1-dev (>= 0.70), libgstreamer-plugins-base0.10-dev, libneon27-dev, librdf0-dev (>= 1.0.8), libglib2.0-dev (>= 2.15.0), libgconf2-dev, liborbit2-dev, gettext, libldap2-dev
Build-Depends-Indep: fdupes, xml-core, imagemagick, fontforge
-Build-Conflicts: libcairo2 (= 1.4.8-1), libxul-dev (= 1.8.0.13~pre070720-0etch1), gjdoc (= 0.7.8-2), libc6-dev (= 2.6.1-3) [i386 amd64], libc6-dev (= 2.6.1-4) [i386 amd64], libc0.1-dev (= 2.13-26) [kfreebsd-i386 kfreebsd-amd64], nvidia-glx-dev, nvidia-glx-legacy-dev, gcj-4.2 (= 4.2.2-6), flex (= 2.5.34-1) [amd64], libboost1.39-dev (<< 1.39.0-2), graphicsmagick-imagemagick-compat (<< 1.3.9~), qt3-dev-tools, ant (= 1.8.0-1) [hppa kfreebsd-i386 kfreebsd-amd64], ant (= 1.8.0-2) [hppa kfreebsd-i386 kfreebsd-amd64], ant (= 1.8.0-3) [hppa kfreebsd-i386 kfreebsd-amd64], g++-4.6 (= 4.6.1-10), g++-4.6 (= 4.6.1-11), base-files (= 6.0), base-files (= 6.0squeeze1), libhsqldb-java (>= 1.8.1~)
+Build-Conflicts: libcairo2 (= 1.4.8-1), libxul-dev (= 1.8.0.13~pre070720-0etch1), gjdoc (= 0.7.8-2), libc6-dev (= 2.6.1-3) [i386 amd64], libc6-dev (= 2.6.1-4) [i386 amd64], libc0.1-dev (= 2.13-26) [kfreebsd-i386 kfreebsd-amd64], nvidia-glx-dev, nvidia-glx-legacy-dev, gcj-4.2 (= 4.2.2-6), flex (= 2.5.34-1) [amd64], libboost1.39-dev (<< 1.39.0-2), graphicsmagick-imagemagick-compat (<< 1.3.9~), qt3-dev-tools, ant (= 1.8.0-1) [hppa kfreebsd-i386 kfreebsd-amd64], ant (= 1.8.0-2) [hppa kfreebsd-i386 kfreebsd-amd64], ant (= 1.8.0-3) [hppa kfreebsd-i386 kfreebsd-amd64], g++-4.6 (= 4.6.1-10), g++-4.6 (= 4.6.1-11), gcc (>= 4.7~) [!i386 !amd64], g++ (>= 4.7~) [!i386 !amd64], base-files (= 6.0), base-files (= 6.0squeeze1), libhsqldb-java (>= 1.8.1~)
Standards-Version: 3.9.1
XS-Python-Version: current
Vcs-Git: https://alioth.debian.org/anonscm/git/pkg-openoffice/libreoffice.git
diff --git a/control.in b/control.in
index 04a205e..a8cbe31 100644
--- a/control.in
+++ b/control.in
@@ -39,7 +39,7 @@ Build-Depends: dpkg-dev (>= 1.16.1),
wget | curl
%BUILD_DEPS%
Build-Depends-Indep: fdupes, xml-core, imagemagick %BUILD_DEPS_INDEP%
-Build-Conflicts: libcairo2 (= 1.4.8-1), libxul-dev (= 1.8.0.13~pre070720-0etch1), gjdoc (= 0.7.8-2), libc6-dev (= 2.6.1-3) [i386 amd64], libc6-dev (= 2.6.1-4) [i386 amd64], libc0.1-dev (= 2.13-26) [kfreebsd-i386 kfreebsd-amd64], nvidia-glx-dev, nvidia-glx-legacy-dev, gcj-4.2 (= 4.2.2-6), flex (= 2.5.34-1) [amd64], libboost1.39-dev (<< 1.39.0-2), graphicsmagick-imagemagick-compat (<< 1.3.9~), qt3-dev-tools, ant (= 1.8.0-1) [%OOO_GCJ_JDK_ARCHS%], ant (= 1.8.0-2) [%OOO_GCJ_JDK_ARCHS%], ant (= 1.8.0-3) [%OOO_GCJ_JDK_ARCHS%], g++-4.6 (= 4.6.1-10), g++-4.6 (= 4.6.1-11)
+Build-Conflicts: libcairo2 (= 1.4.8-1), libxul-dev (= 1.8.0.13~pre070720-0etch1), gjdoc (= 0.7.8-2), libc6-dev (= 2.6.1-3) [i386 amd64], libc6-dev (= 2.6.1-4) [i386 amd64], libc0.1-dev (= 2.13-26) [kfreebsd-i386 kfreebsd-amd64], nvidia-glx-dev, nvidia-glx-legacy-dev, gcj-4.2 (= 4.2.2-6), flex (= 2.5.34-1) [amd64], libboost1.39-dev (<< 1.39.0-2), graphicsmagick-imagemagick-compat (<< 1.3.9~), qt3-dev-tools, ant (= 1.8.0-1) [%OOO_GCJ_JDK_ARCHS%], ant (= 1.8.0-2) [%OOO_GCJ_JDK_ARCHS%], ant (= 1.8.0-3) [%OOO_GCJ_JDK_ARCHS%], g++-4.6 (= 4.6.1-10), g++-4.6 (= 4.6.1-11), gcc (>= 4.7~) [!i386 !amd64], g++ (>= 4.7~) [!i386 !amd64]
Standards-Version: 3.9.1
XS-Python-Version: @PYTHON_VERSION@
Vcs-Git: https://alioth.debian.org/anonscm/git/pkg-openoffice/libreoffice.git
diff --git a/patches/gcc-4.7-amd64.diff b/patches/gcc-4.7-amd64.diff
new file mode 100644
index 0000000..b843158
--- /dev/null
+++ b/patches/gcc-4.7-amd64.diff
@@ -0,0 +1,619 @@
+m 0fdbb5b0eabbaa571f3747fda12a56c938cba474 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Thu, 29 Mar 2012 15:50:16 +0000
+Subject: Make cpp_uno/gcc3_linux_x86-64 bridge work with GCC 4.7
+
+See comment in callvirtualmethod.cxx for details.
+
+From fa09866ccb5bc197ad3e1ec1a453d6fab20cd7df Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Fri, 30 Mar 2012 11:58:34 +0000
+Subject: Adapt cpp_uno/gcc3_linux_x86-64 to GCC 4.7 cxxabi.h
+
+...the same way cpp_uno/mingw_intel was already adapted.
+
+--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
+@@ -59,9 +59,9 @@
+ OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------- */
+
+-#include <abi.hxx>
++#include "sal/config.h"
+
+-#include <rtl/ustring.hxx>
++#include "abi.hxx"
+
+ using namespace x86_64;
+
+@@ -98,6 +98,7 @@ enum x86_64_reg_class
+
+ static enum x86_64_reg_class
+ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
++ throw ()
+ {
+ /* Rule #1: If both classes are equal, this is the resulting class. */
+ if (class1 == class2)
+@@ -140,7 +141,7 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
+ See the x86-64 PS ABI for details.
+ */
+ static int
+-classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int byteOffset )
++classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int byteOffset ) throw ()
+ {
+ switch ( pTypeRef->eTypeClass )
+ {
+@@ -262,7 +263,7 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c
+
+ /* Examine the argument and return set number of register required in each
+ class. Return 0 iff parameter should be passed in memory. */
+-bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE )
++bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) throw ()
+ {
+ enum x86_64_reg_class classes[MAX_CLASSES];
+ int n;
+@@ -303,14 +304,14 @@ bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool
+ return true;
+ }
+
+-bool x86_64::return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef )
++bool x86_64::return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) throw ()
+ {
+ int g, s;
+
+ return examine_argument( pTypeRef, true, g, s ) == 0;
+ }
+
+-void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64 *pGPR, const double *pSSE, void *pStruct )
++void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64 *pGPR, const double *pSSE, void *pStruct ) throw ()
+ {
+ enum x86_64_reg_class classes[MAX_CLASSES];
+ int n;
+unchanged:
+--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
+@@ -51,7 +51,7 @@ const sal_uInt32 MAX_SSE_REGS = 8;
+
+ Return false iff parameter should be passed in memory.
+ */
+-bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE );
++bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) throw ();
+
+ /** Does function that returns this type use a hidden parameter, or registers?
+
+@@ -59,9 +59,9 @@ bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInRetur
+ pointer to a structure allocated by the caller), or in registers (rax, rdx
+ for the integers, xmm0, xmm1 for the floating point numbers).
+ */
+-bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
++bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) throw ();
+
+-void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct );
++void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct ) throw ();
+
+ } // namespace x86_64
+
+unchanged:
+--- a/dev/null
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx
+@@ -0,0 +1,170 @@
++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include "sal/config.h"
++
++#include <cstring>
++
++#include "sal/types.h"
++#include "typelib/typeclass.h"
++#include "typelib/typedescription.h"
++
++#include "abi.hxx"
++#include "callvirtualmethod.hxx"
++
++// The call instruction within the asm block of callVirtualMethod may throw
++// exceptions. At least GCC 4.7.0 with -O0 would create (unnecessary)
++// .gcc_exception_table call-site table entries around all other calls in this
++// function that can throw, leading to std::terminate if the asm call throws an
++// exception and the unwinding C++ personality routine finds the unexpected hole
++// in the .gcc_exception_table. Therefore, make sure this function explicitly
++// only calls nothrow-functions (so GCC 4.7.0 with -O0 happens to not create a
++// .gcc_exception_table section at all for this function). For some reason,
++// this also needs to be in a source file of its own.
++//
++// Also, this file should be compiled with -fnon-call-exceptions, and ideally
++// there would be a way to tell the compiler that the asm block contains calls
++// to functions that can potentially throw; see the mail thread starting at
++// <http://gcc.gnu.org/ml/gcc/2012-03/msg00454.html> "C++: Letting compiler know
++// asm block can call function that can throw?"
++
++void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
++ void * pThis, sal_uInt32 nVtableIndex, void * pRegisterReturn,
++ typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn,
++ sal_uInt64 *pStack, sal_uInt32 nStack, sal_uInt64 *pGPR, sal_uInt32 nGPR,
++ double * pFPR, sal_uInt32 nFPR)
++{
++ // Should not happen, but...
++ if ( nFPR > x86_64::MAX_SSE_REGS )
++ nFPR = x86_64::MAX_SSE_REGS;
++ if ( nGPR > x86_64::MAX_GPR_REGS )
++ nGPR = x86_64::MAX_GPR_REGS;
++
++ // Get pointer to method
++ sal_uInt64 pMethod = *((sal_uInt64 *)pThis);
++ pMethod += 8 * nVtableIndex;
++ pMethod = *((sal_uInt64 *)pMethod);
++
++ // Load parameters to stack, if necessary
++ if ( nStack )
++ {
++ // 16-bytes aligned
++ sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16;
++ sal_uInt64 *pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes );
++ std::memcpy( pCallStack, pStack, nStackBytes );
++ }
++
++ // Return values
++ sal_uInt64 rax;
++ sal_uInt64 rdx;
++ double xmm0;
++ double xmm1;
++
++ asm volatile (
++
++ // Fill the xmm registers
++ "movq %6, %%rax\n\t"
++
++ "movsd (%%rax), %%xmm0\n\t"
++ "movsd 8(%%rax), %%xmm1\n\t"
++ "movsd 16(%%rax), %%xmm2\n\t"
++ "movsd 24(%%rax), %%xmm3\n\t"
++ "movsd 32(%%rax), %%xmm4\n\t"
++ "movsd 40(%%rax), %%xmm5\n\t"
++ "movsd 48(%%rax), %%xmm6\n\t"
++ "movsd 56(%%rax), %%xmm7\n\t"
++
++ // Fill the general purpose registers
++ "movq %5, %%rax\n\t"
++
++ "movq (%%rax), %%rdi\n\t"
++ "movq 8(%%rax), %%rsi\n\t"
++ "movq 16(%%rax), %%rdx\n\t"
++ "movq 24(%%rax), %%rcx\n\t"
++ "movq 32(%%rax), %%r8\n\t"
++ "movq 40(%%rax), %%r9\n\t"
++
++ // Perform the call
++ "movq %4, %%r11\n\t"
++ "movq %7, %%rax\n\t"
++ "call *%%r11\n\t"
++
++ // Fill the return values
++ "movq %%rax, %0\n\t"
++ "movq %%rdx, %1\n\t"
++ "movsd %%xmm0, %2\n\t"
++ "movsd %%xmm1, %3\n\t"
++ : "=m" ( rax ), "=m" ( rdx ), "=m" ( xmm0 ), "=m" ( xmm1 )
++ : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR )
++ : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11"
++ );
++
++ switch (pReturnTypeRef->eTypeClass)
++ {
++ case typelib_TypeClass_HYPER:
++ case typelib_TypeClass_UNSIGNED_HYPER:
++ *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = rax;
++ break;
++ case typelib_TypeClass_LONG:
++ case typelib_TypeClass_UNSIGNED_LONG:
++ case typelib_TypeClass_ENUM:
++ *reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &rax );
++ break;
++ case typelib_TypeClass_CHAR:
++ case typelib_TypeClass_SHORT:
++ case typelib_TypeClass_UNSIGNED_SHORT:
++ *reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &rax );
++ break;
++ case typelib_TypeClass_BOOLEAN:
++ case typelib_TypeClass_BYTE:
++ *reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &rax );
++ break;
++ case typelib_TypeClass_FLOAT:
++ case typelib_TypeClass_DOUBLE:
++ *reinterpret_cast<double *>( pRegisterReturn ) = xmm0;
++ break;
++ default:
++ {
++ sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize;
++ if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0)
++ {
++ sal_uInt64 longs[2];
++ longs[0] = rax;
++ longs[1] = rdx;
++
++ double doubles[2];
++ doubles[0] = xmm0;
++ doubles[1] = xmm1;
++ x86_64::fill_struct( pReturnTypeRef, &longs[0], &doubles[0], pRegisterReturn);
++ }
++ break;
++ }
++ }
++}
++
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+unchanged:
+--- a/dev/null
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.hxx
+@@ -0,0 +1,49 @@
++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_GCC3_LINUX_X86_64_CALLVIRTUALMETHOD_HXX
++#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_GCC3_LINUX_X86_64_CALLVIRTUALMETHOD_HXX
++
++#include "sal/config.h"
++
++#include "sal/types.h"
++#include "typelib/typedescription.h"
++
++namespace CPPU_CURRENT_NAMESPACE {
++
++void callVirtualMethod(
++ void * pThis, sal_uInt32 nVtableIndex, void * pRegisterReturn,
++ typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn,
++ sal_uInt64 *pStack, sal_uInt32 nStack, sal_uInt64 *pGPR, sal_uInt32 nGPR,
++ double * pFPR, sal_uInt32 nFPR);
++
++}
++
++#endif
++
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+diff -u b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+--- b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+@@ -30,7 +30,12 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <dlfcn.h>
++
+ #include <cxxabi.h>
++#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
++#define _GLIBCXX_CDTOR_CALLABI
++#endif
++
+ #include <boost/unordered_map.hpp>
+
+ #include <rtl/instance.hxx>
+@@ -57,10 +62,6 @@
+ namespace CPPU_CURRENT_NAMESPACE
+ {
+
+-void dummy_can_throw_anything( char const * )
+-{
+-}
+-
+ //==================================================================================================
+ static OUString toUNOname( char const * p ) SAL_THROW( () )
+ {
+@@ -217,7 +218,8 @@
+ struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {};
+
+ //--------------------------------------------------------------------------------------------------
+-static void deleteException( void * pExc )
++extern "C" {
++static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
+ {
+ __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
+ typelib_TypeDescription * pTD = 0;
+@@ -230,6 +232,7 @@
+ ::typelib_typedescription_release( pTD );
+ }
+ }
++}
+
+ //==================================================================================================
+ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
+unchanged:
+--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/makefile.mk
+@@ -57,6 +57,7 @@ CFLAGSCXX += -fno-omit-frame-pointer -fno-strict-aliasing
+ SLOFILES= \
+ $(SLO)$/abi.obj \
+ $(SLO)$/except.obj \
++ $(SLO)$/callvirtualmethod.obj \
+ $(SLO)$/cpp2uno.obj \
+ $(SLO)$/uno2cpp.obj \
+ $(SLO)$/call.obj
+diff -u b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
+--- b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
+@@ -35,8 +35,6 @@
+ namespace CPPU_CURRENT_NAMESPACE
+ {
+
+-void dummy_can_throw_anything( char const * );
+-
+ // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+
+ struct _Unwind_Exception
+@@ -68,17 +66,26 @@
+ _Unwind_Exception unwindHeader;
+ };
+
+-extern "C" void *__cxa_allocate_exception(
+- std::size_t thrown_size ) throw();
+-extern "C" void __cxa_throw (
+- void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
+-
+ struct __cxa_eh_globals
+ {
+ __cxa_exception *caughtExceptions;
+ unsigned int uncaughtExceptions;
+ };
+-extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
++
++}
++
++extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
++
++// The following are in cxxabi.h since GCC 4.7:
++#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
++extern "C" void *__cxa_allocate_exception(
++ std::size_t thrown_size ) throw();
++extern "C" void __cxa_throw (
++ void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
++#endif
++
++namespace CPPU_CURRENT_NAMESPACE
++{
+
+ // -----
+
+diff -u b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+--- b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
++++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+@@ -26,12 +26,9 @@
+ *
+ ************************************************************************/
+
+-
++#include <alloca.h>
+ #include <exception>
+ #include <typeinfo>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+
+ #include "rtl/alloc.h"
+ #include "rtl/ustrbuf.hxx"
+@@ -46,159 +43,12 @@
+ #include "bridges/cpp_uno/shared/vtables.hxx"
+
+ #include "abi.hxx"
++#include "callvirtualmethod.hxx"
+ #include "share.hxx"
+
+ using namespace ::rtl;
+ using namespace ::com::sun::star::uno;
+
+-//==================================================================================================
+-static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
+- void * pRegisterReturn, typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn,
+- sal_uInt64 *pStack, sal_uInt32 nStack,
+- sal_uInt64 *pGPR, sal_uInt32 nGPR,
+- double *pFPR, sal_uInt32 nFPR) __attribute__((noinline));
+-
+-static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
+- void * pRegisterReturn, typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn,
+- sal_uInt64 *pStack, sal_uInt32 nStack,
+- sal_uInt64 *pGPR, sal_uInt32 nGPR,
+- double *pFPR, sal_uInt32 nFPR)
+-{
+-#if OSL_DEBUG_LEVEL > 1
+- // Let's figure out what is really going on here
+- {
+- fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR );
+- for ( unsigned int i = 0; i < nGPR; ++i )
+- fprintf( stderr, "0x%lx, ", pGPR[i] );
+- fprintf( stderr, "\nFPR's (%d): ", nFPR );
+- for ( unsigned int i = 0; i < nFPR; ++i )
+- fprintf( stderr, "%f, ", pFPR[i] );
+- fprintf( stderr, "\nStack (%d): ", nStack );
+- for ( unsigned int i = 0; i < nStack; ++i )
+- fprintf( stderr, "0x%lx, ", pStack[i] );
+- fprintf( stderr, "\n" );
+- }
+-#endif
+-
+- // The call instruction within the asm section of callVirtualMethod may throw
+- // exceptions. So that the compiler handles this correctly, it is important
+- // that (a) callVirtualMethod might call dummy_can_throw_anything (although this
+- // never happens at runtime), which in turn can throw exceptions, and (b)
+- // callVirtualMethod is not inlined at its call site (so that any exceptions are
+- // caught which are thrown from the instruction calling callVirtualMethod):
+- if ( !pThis )
+- CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything( "xxx" ); // address something
+-
+- // Should not happen, but...
+- if ( nFPR > x86_64::MAX_SSE_REGS )
+- nFPR = x86_64::MAX_SSE_REGS;
+- if ( nGPR > x86_64::MAX_GPR_REGS )
+- nGPR = x86_64::MAX_GPR_REGS;
+-
+- // Get pointer to method
+- sal_uInt64 pMethod = *((sal_uInt64 *)pThis);
+- pMethod += 8 * nVtableIndex;
+- pMethod = *((sal_uInt64 *)pMethod);
+-
+- // Load parameters to stack, if necessary
+- if ( nStack )
+- {
+- // 16-bytes aligned
+- sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16;
+- sal_uInt64 *pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes );
+- memcpy( pCallStack, pStack, nStackBytes );
+- }
+-
+- // Return values
+- sal_uInt64 rax;
+- sal_uInt64 rdx;
+- double xmm0;
+- double xmm1;
+-
+- asm volatile (
+-
+- // Fill the xmm registers
+- "movq %6, %%rax\n\t"
+-
+- "movsd (%%rax), %%xmm0\n\t"
+- "movsd 8(%%rax), %%xmm1\n\t"
+- "movsd 16(%%rax), %%xmm2\n\t"
+- "movsd 24(%%rax), %%xmm3\n\t"
+- "movsd 32(%%rax), %%xmm4\n\t"
+- "movsd 40(%%rax), %%xmm5\n\t"
+- "movsd 48(%%rax), %%xmm6\n\t"
+- "movsd 56(%%rax), %%xmm7\n\t"
+-
+- // Fill the general purpose registers
+- "movq %5, %%rax\n\t"
+-
+- "movq (%%rax), %%rdi\n\t"
+- "movq 8(%%rax), %%rsi\n\t"
+- "movq 16(%%rax), %%rdx\n\t"
+- "movq 24(%%rax), %%rcx\n\t"
+- "movq 32(%%rax), %%r8\n\t"
+- "movq 40(%%rax), %%r9\n\t"
+-
+- // Perform the call
+- "movq %4, %%r11\n\t"
+- "movq %7, %%rax\n\t"
+- "call *%%r11\n\t"
+-
+- // Fill the return values
+- "movq %%rax, %0\n\t"
+- "movq %%rdx, %1\n\t"
+- "movsd %%xmm0, %2\n\t"
+- "movsd %%xmm1, %3\n\t"
+- : "=m" ( rax ), "=m" ( rdx ), "=m" ( xmm0 ), "=m" ( xmm1 )
+- : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR )
+- : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11"
+- );
+-
+- switch (pReturnTypeRef->eTypeClass)
+- {
+- case typelib_TypeClass_HYPER:
+- case typelib_TypeClass_UNSIGNED_HYPER:
+- *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = rax;
+- break;
+- case typelib_TypeClass_LONG:
+- case typelib_TypeClass_UNSIGNED_LONG:
+- case typelib_TypeClass_ENUM:
+- *reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &rax );
+- break;
+- case typelib_TypeClass_CHAR:
+- case typelib_TypeClass_SHORT:
+- case typelib_TypeClass_UNSIGNED_SHORT:
+- *reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &rax );
+- break;
+- case typelib_TypeClass_BOOLEAN:
+- case typelib_TypeClass_BYTE:
+- *reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &rax );
+- break;
+- case typelib_TypeClass_FLOAT:
+- case typelib_TypeClass_DOUBLE:
+- *reinterpret_cast<double *>( pRegisterReturn ) = xmm0;
+- break;
+- default:
+- {
+- sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize;
+- if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0)
+- {
+- sal_uInt64 longs[2];
+- longs[0] = rax;
+- longs[1] = rdx;
+-
+- double doubles[2];
+- doubles[0] = xmm0;
+- doubles[1] = xmm1;
+- x86_64::fill_struct( pReturnTypeRef, &longs[0], &doubles[0], pRegisterReturn);
+- }
+- break;
+- }
+- }
+-}
+-
+-//==================================================================================================
+-
+ // Macros for easier insertion of values to registers or stack
+ // pSV - pointer to the source
+ // nr - order of the value [will be increased if stored to register]
+@@ -384,7 +234,7 @@
+ try
+ {
+ try {
+- callVirtualMethod(
++ CPPU_CURRENT_NAMESPACE::callVirtualMethod(
+ pAdjustedThisPtr, aVtableSlot.index,
+ pCppReturn, pReturnTypeRef, bSimpleReturn,
+ pStackStart, ( pStack - pStackStart ),
+@@ -450,7 +300,7 @@
+ catch (...)
+ {
+ // fill uno exception
+- fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
++ fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+
+ // temporary params
+ for ( ; nTempIndizes--; )
diff --git a/patches/gcc-4.7-i386.diff b/patches/gcc-4.7-i386.diff
new file mode 100644
index 0000000..8319e56
--- /dev/null
+++ b/patches/gcc-4.7-i386.diff
@@ -0,0 +1,494 @@
+From b0515ea5fa6c29faebed616ae3e0213c72d24904 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Wed, 04 Apr 2012 11:02:44 +0000
+Subject: Adapt cpp_uno/gcc3_linux_intel to GCC 4.7
+
+...the same way cpp_uno/gcc3_linux_x86-64 was already adapted.
+---
+diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
+new file mode 100644
+index 0000000..4c6370f
+--- a/dev/null
++++ b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
+@@ -0,0 +1,154 @@
++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#include "sal/config.h"
++
++#include <cassert>
++
++#include "cppu/macros.hxx"
++#include "sal/types.h"
++#include "typelib/typeclass.h"
++#include "typelib/typedescription.h"
++
++#include "callvirtualmethod.hxx"
++
++// The call instruction within the asm block of callVirtualMethod may throw
++// exceptions. At least GCC 4.7.0 with -O0 would create (unnecessary)
++// .gcc_exception_table call-site table entries around all other calls in this
++// function that can throw, leading to std::terminate if the asm call throws an
++// exception and the unwinding C++ personality routine finds the unexpected hole
++// in the .gcc_exception_table. Therefore, make sure this function explicitly
++// only calls nothrow-functions (so GCC 4.7.0 with -O0 happens to not create a
++// .gcc_exception_table section at all for this function). For some reason,
++// this also needs to be in a source file of its own.
++//
++// Also, this file should be compiled with -fnon-call-exceptions, and ideally
++// there would be a way to tell the compiler that the asm block contains calls
++// to functions that can potentially throw; see the mail thread starting at
++// <http://gcc.gnu.org/ml/gcc/2012-03/msg00454.html> "C++: Letting compiler know
++// asm block can call function that can throw?"
++
++void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
++ void * pAdjustedThisPtr, sal_Int32 nVtableIndex, void * pRegisterReturn,
++ typelib_TypeDescription * pReturnTypeDescr, bool bSimpleReturn,
++ sal_Int32 * pStackLongs, sal_Int32 nStackLongs)
++{
++ // parameter list is mixed list of * and values
++ // reference parameters are pointers
++
++ assert(pStackLongs && pAdjustedThisPtr);
++ assert(sizeof (void *) == 4 && sizeof (sal_Int32) == 4);
++ // unexpected size of int
++ assert(nStackLongs && pStackLongs); // no stack
++
++ volatile long edx = 0, eax = 0; // for register returns
++ void * stackptr;
++ asm volatile (
++ "mov %%esp, %6\n\t"
++ // preserve potential 128bit stack alignment
++ "and $0xfffffff0, %%esp\n\t"
++ "mov %0, %%eax\n\t"
++ "lea -4(,%%eax,4), %%eax\n\t"
++ "and $0xf, %%eax\n\t"
++ "sub $0xc, %%eax\n\t"
++ "add %%eax, %%esp\n\t"
++ // copy values
++ "mov %0, %%eax\n\t"
++ "mov %%eax, %%edx\n\t"
++ "dec %%edx\n\t"
++ "shl $2, %%edx\n\t"
++ "add %1, %%edx\n"
++ "Lcopy:\n\t"
++ "pushl 0(%%edx)\n\t"
++ "sub $4, %%edx\n\t"
++ "dec %%eax\n\t"
++ "jne Lcopy\n\t"
++ // do the actual call
++ "mov %2, %%edx\n\t"
++ "mov 0(%%edx), %%edx\n\t"
++ "mov %3, %%eax\n\t"
++ "shl $2, %%eax\n\t"
++ "add %%eax, %%edx\n\t"
++ "mov 0(%%edx), %%edx\n\t"
++ "call *%%edx\n\t"
++ // save return registers
++ "mov %%eax, %4\n\t"
++ "mov %%edx, %5\n\t"
++ // cleanup stack
++ "mov %6, %%esp\n\t"
++ :
++ : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
++ "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
++ : "eax", "ecx", "edx" );
++ switch( pReturnTypeDescr->eTypeClass )
++ {
++ case typelib_TypeClass_VOID:
++ break;
++ case typelib_TypeClass_HYPER:
++ case typelib_TypeClass_UNSIGNED_HYPER:
++ ((long*)pRegisterReturn)[1] = edx;
++ case typelib_TypeClass_LONG:
++ case typelib_TypeClass_UNSIGNED_LONG:
++ case typelib_TypeClass_CHAR:
++ case typelib_TypeClass_ENUM:
++ ((long*)pRegisterReturn)[0] = eax;
++ break;
++ case typelib_TypeClass_SHORT:
++ case typelib_TypeClass_UNSIGNED_SHORT:
++ *(unsigned short*)pRegisterReturn = eax;
++ break;
++ case typelib_TypeClass_BOOLEAN:
++ case typelib_TypeClass_BYTE:
++ *(unsigned char*)pRegisterReturn = eax;
++ break;
++ case typelib_TypeClass_FLOAT:
++ asm ( "fstps %0" : : "m"(*(char *)pRegisterReturn) );
++ break;
++ case typelib_TypeClass_DOUBLE:
++ asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) );
++ break;
++ default:
++ {
++#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX) || \
++ defined(DRAGONFLY)
++ sal_Int32 const nRetSize = pReturnTypeDescr->nSize;
++ if (bSimpleReturn && nRetSize <= 8 && nRetSize > 0)
++ {
++ if (nRetSize > 4)
++ static_cast<long *>(pRegisterReturn)[1] = edx;
++ static_cast<long *>(pRegisterReturn)[0] = eax;
++ }
++#else
++ (void)bSimpleReturn;
++#endif
++ break;
++ }
++ }
++}
++
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.hxx
+new file mode 100644
+index 0000000..de498a3
+--- a/dev/null
++++ b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.hxx
+@@ -0,0 +1,49 @@
++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2000, 2010 Oracle and/or its affiliates.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_GCC3_LINUX_X86_64_CALLVIRTUALMETHOD_HXX
++#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_GCC3_LINUX_X86_64_CALLVIRTUALMETHOD_HXX
++
++#include "sal/config.h"
++
++#include "cppu/macros.hxx"
++#include "sal/types.h"
++#include "typelib/typedescription.h"
++
++namespace CPPU_CURRENT_NAMESPACE {
++
++void callVirtualMethod(
++ void * pAdjustedThisPtr, sal_Int32 nVtableIndex, void * pRegisterReturn,
++ typelib_TypeDescription * pReturnTypeDescr, bool bSimpleReturn,
++ sal_Int32 * pStackLongs, sal_Int32 nStackLongs);
++
++}
++
++#endif
++
++/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+index c21df26..6515b8f 100644
+--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
++++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+@@ -33,6 +33,9 @@
+ #include <boost/unordered_map.hpp>
+
+ #include <cxxabi.h>
++#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
++#define _GLIBCXX_CDTOR_CALLABI
++#endif
+
+ #include <rtl/instance.hxx>
+ #include <rtl/strbuf.hxx>
+@@ -57,10 +60,6 @@ using namespace ::__cxxabiv1;
+ namespace CPPU_CURRENT_NAMESPACE
+ {
+
+-void dummy_can_throw_anything( char const * )
+-{
+-}
+-
+ //==================================================================================================
+ static OUString toUNOname( char const * p ) SAL_THROW( () )
+ {
+@@ -217,7 +216,8 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
+ struct RTTISingleton: public rtl::Static< RTTI, RTTISingleton > {};
+
+ //--------------------------------------------------------------------------------------------------
+-static void deleteException( void * pExc )
++extern "C" {
++static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
+ {
+ __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
+ typelib_TypeDescription * pTD = 0;
+@@ -230,6 +230,7 @@ static void deleteException( void * pExc )
+ ::typelib_typedescription_release( pTD );
+ }
+ }
++}
+
+ //==================================================================================================
+ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
+diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
+index 10d24a3..c814132 100644
+--- a/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
++++ b/bridges/source/cpp_uno/gcc3_linux_intel/makefile.mk
+@@ -58,6 +58,7 @@ CFLAGSNOOPT=-O0
+
+ SLOFILES= \
+ $(SLO)$/except.obj \
++ $(SLO)$/callvirtualmethod.obj \
+ $(SLO)$/cpp2uno.obj \
+ $(SLO)$/uno2cpp.obj \
+ $(SLO)$/call.obj
+diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
+index 8a3e136..2eff557 100644
+--- a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
++++ b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
+@@ -35,8 +35,6 @@
+ namespace CPPU_CURRENT_NAMESPACE
+ {
+
+-void dummy_can_throw_anything( char const * );
+-
+ // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+
+ struct _Unwind_Exception
+@@ -68,17 +66,30 @@ struct __cxa_exception
+ _Unwind_Exception unwindHeader;
+ };
+
+-extern "C" void *__cxa_allocate_exception(
+- std::size_t thrown_size ) throw();
+-extern "C" void __cxa_throw (
+- void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
+-
+ struct __cxa_eh_globals
+ {
+ __cxa_exception *caughtExceptions;
+ unsigned int uncaughtExceptions;
+ };
+-extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
++
++}
++
++extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
++
++namespace CPPU_CURRENT_NAMESPACE
++{
++
++// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
++// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
++// declarations for them, e.g., with or without throw() specification, so would
++// complain about redeclarations of these somewhat implicitly declared
++// functions):
++#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
++extern "C" void *__cxa_allocate_exception(
++ std::size_t thrown_size ) throw();
++extern "C" void __cxa_throw (
++ void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
++#endif
+
+ // -----
+
+diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+index 49bac65..64d401b 100644
+--- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
++++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+@@ -30,7 +30,7 @@
+ #if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
+ #include <stdlib.h>
+ #else
+-#include <malloc.h>
++#include <alloca.h>
+ #endif
+
+ #include <com/sun/star/uno/genfunc.hxx>
+@@ -42,6 +42,7 @@
+ #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
+ #include "bridges/cpp_uno/shared/vtables.hxx"
+
++#include "callvirtualmethod.hxx"
+ #include "share.hxx"
+
+ using namespace ::rtl;
+@@ -50,125 +51,6 @@ using namespace ::com::sun::star::uno;
+ namespace
+ {
+
+-//==================================================================================================
+-// The call instruction within the asm section of callVirtualMethod may throw
+-// exceptions. So that the compiler handles this correctly, it is important
+-// that (a) callVirtualMethod might call dummy_can_throw_anything (although this
+-// never happens at runtime), which in turn can throw exceptions, and (b)
+-// callVirtualMethod is not inlined at its call site (so that any exceptions are
+-// caught which are thrown from the instruction calling callVirtualMethod):
+-void callVirtualMethod(
+- void * pAdjustedThisPtr,
+- sal_Int32 nVtableIndex,
+- void * pRegisterReturn,
+- typelib_TypeDescription * pReturnTypeDescr, bool bSimpleReturn,
+- sal_Int32 * pStackLongs,
+- sal_Int32 nStackLongs ) __attribute__((noinline));
+-
+-void callVirtualMethod(
+- void * pAdjustedThisPtr,
+- sal_Int32 nVtableIndex,
+- void * pRegisterReturn,
+- typelib_TypeDescription * pReturnTypeDescr, bool bSimpleReturn,
+- sal_Int32 * pStackLongs,
+- sal_Int32 nStackLongs )
+-{
+- // parameter list is mixed list of * and values
+- // reference parameters are pointers
+-
+- OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" );
+- OSL_ENSURE( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" );
+- OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" );
+-
+- // never called
+- if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
+-
+- volatile long edx = 0, eax = 0; // for register returns
+- void * stackptr;
+- asm volatile (
+- "mov %%esp, %6\n\t"
+- // preserve potential 128bit stack alignment
+- "and $0xfffffff0, %%esp\n\t"
+- "mov %0, %%eax\n\t"
+- "lea -4(,%%eax,4), %%eax\n\t"
+- "and $0xf, %%eax\n\t"
+- "sub $0xc, %%eax\n\t"
+- "add %%eax, %%esp\n\t"
+- // copy values
+- "mov %0, %%eax\n\t"
+- "mov %%eax, %%edx\n\t"
+- "dec %%edx\n\t"
+- "shl $2, %%edx\n\t"
+- "add %1, %%edx\n"
+- "Lcopy:\n\t"
+- "pushl 0(%%edx)\n\t"
+- "sub $4, %%edx\n\t"
+- "dec %%eax\n\t"
+- "jne Lcopy\n\t"
+- // do the actual call
+- "mov %2, %%edx\n\t"
+- "mov 0(%%edx), %%edx\n\t"
+- "mov %3, %%eax\n\t"
+- "shl $2, %%eax\n\t"
+- "add %%eax, %%edx\n\t"
+- "mov 0(%%edx), %%edx\n\t"
+- "call *%%edx\n\t"
+- // save return registers
+- "mov %%eax, %4\n\t"
+- "mov %%edx, %5\n\t"
+- // cleanup stack
+- "mov %6, %%esp\n\t"
+- :
+- : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
+- "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
+- : "eax", "ecx", "edx" );
+- switch( pReturnTypeDescr->eTypeClass )
+- {
+- case typelib_TypeClass_VOID:
+- break;
+- case typelib_TypeClass_HYPER:
+- case typelib_TypeClass_UNSIGNED_HYPER:
+- ((long*)pRegisterReturn)[1] = edx;
+- case typelib_TypeClass_LONG:
+- case typelib_TypeClass_UNSIGNED_LONG:
+- case typelib_TypeClass_CHAR:
+- case typelib_TypeClass_ENUM:
+- ((long*)pRegisterReturn)[0] = eax;
+- break;
+- case typelib_TypeClass_SHORT:
+- case typelib_TypeClass_UNSIGNED_SHORT:
+- *(unsigned short*)pRegisterReturn = eax;
+- break;
+- case typelib_TypeClass_BOOLEAN:
+- case typelib_TypeClass_BYTE:
+- *(unsigned char*)pRegisterReturn = eax;
+- break;
+- case typelib_TypeClass_FLOAT:
+- asm ( "fstps %0" : : "m"(*(char *)pRegisterReturn) );
+- break;
+- case typelib_TypeClass_DOUBLE:
+- asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) );
+- break;
+- default:
+- {
+-#if defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD) || defined(MACOSX) || \
+- defined(DRAGONFLY)
+- sal_Int32 const nRetSize = pReturnTypeDescr->nSize;
+- if (bSimpleReturn && nRetSize <= 8 && nRetSize > 0)
+- {
+- if (nRetSize > 4)
+- static_cast<long *>(pRegisterReturn)[1] = edx;
+- static_cast<long *>(pRegisterReturn)[0] = eax;
+- }
+-#else
+- (void)bSimpleReturn;
+-#endif
+- break;
+- }
+- }
+-}
+-
+-//==================================================================================================
+ static void cpp_call(
+ bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
+ bridges::cpp_uno::shared::VtableSlot aVtableSlot,
+@@ -287,7 +169,7 @@ static void cpp_call(
+ try
+ {
+ OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" );
+- callVirtualMethod(
++ CPPU_CURRENT_NAMESPACE::callVirtualMethod(
+ pAdjustedThisPtr, aVtableSlot.index,
+ pCppReturn, pReturnTypeDescr, bSimpleReturn,
+ (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) );
+@@ -330,7 +212,7 @@ static void cpp_call(
+ catch (...)
+ {
+ // fill uno exception
+- fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
++ fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+
+ // temporary params
+ for ( ; nTempIndizes--; )
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/patches/gcc-4.7.diff b/patches/gcc-4.7.diff
new file mode 100644
index 0000000..8e88ca5
--- /dev/null
+++ b/patches/gcc-4.7.diff
@@ -0,0 +1,122 @@
+From 31d26fb9b85cd54267e1a5c0d5a3595e8bb4884c Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Thu, 29 Mar 2012 12:03:08 +0000
+Subject: GCC 4.7 -Werror=enum-compare
+
+---
+diff --git a/vigra/makefile.mk b/vigra/makefile.mk
+index c8e4f77..6cee4b0 100644
+--- a/vigra/makefile.mk
++++ b/vigra/makefile.mk
+@@ -55,6 +55,13 @@ PATCH_FILES=$(TARFILE_NAME).patch
+ TARFILE_MD5=ea91f2fb4212a21d708aced277e6e85a
+ PATCH_FILES=$(TARFILE_NAME).patch
+
++# At least GCC 4.7 treats more correctly now the type of enumerators prior to
++# the closing brace of the enum-specifier (see [dcl.enum] in the C++ 2003
++# Standard), leading to "comparison between <enum1> and <enum2> [-Werror=enum-
++# compare]" and "enumeral mismatch in conditional expression [-Werror]"
++# warnings:
++PATCH_FILES += vigra1.4.0-enumwarn.patch
++
+ CONFIGURE_DIR=
+ CONFIGURE_ACTION=
+
+diff --git a/vigra/vigra1.4.0-enumwarn.patch b/vigra/vigra1.4.0-enumwarn.patch
+new file mode 100644
+index 0000000..8ea1ed7
+--- a/dev/null
++++ b/vigra/vigra1.4.0-enumwarn.patch
+@@ -0,0 +1,13 @@
++--- misc/vigra1.4.0/include/vigra/sized_int.hxx 2012-03-28 13:36:02.743956393 +0200
+++++ misc/build/vigra1.4.0/include/vigra/sized_int.hxx 2012-03-28 13:35:44.956057143 +0200
++@@ -80,8 +80,8 @@
++ template<class LIST>
++ struct SelectBiggestIntegerType
++ {
++- enum { cursize = LIST::size,
++- nextsize = SelectBiggestIntegerType<typename LIST::next>::size,
+++ enum { cursize = static_cast< int >(LIST::size),
+++ nextsize = static_cast< int >(SelectBiggestIntegerType<typename LIST::next>::size),
++ size = (cursize < nextsize) ? nextsize : cursize };
++ typedef typename
++ IfBool<(cursize < nextsize),
+--
+cgit v0.9.0.2-2-gbebe
+From 8431ad2d8b64400052b8e6e218117dd9fb72f316 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman@redhat.com>
+Date: Thu, 29 Mar 2012 11:57:35 +0000
+Subject: Backport some Boost 1.48.0 changes to keep GCC 4.7 -std=c++11 happy
+
+---
+diff --git a/boost/boost_1_44_0-gcc4.7.patch b/boost/boost_1_44_0-gcc4.7.patch
+new file mode 100644
+index 0000000..842a92a
+--- a/dev/null
++++ b/boost/boost_1_44_0-gcc4.7.patch
+@@ -0,0 +1,49 @@
++--- misc/boost_1_44_0/boost/smart_ptr/shared_ptr.hpp 2009-12-14 18:44:19.000000000 +0100
+++++ misc/build/boost_1_44_0/boost/smart_ptr/shared_ptr.hpp 2012-03-28 08:32:46.772493003 +0200
++@@ -207,7 +207,17 @@
++ boost::detail::sp_enable_shared_from_this( this, p, p );
++ }
++
++-// generated copy constructor, destructor are fine
+++// generated copy constructor, destructor are fine...
+++
+++#if defined( BOOST_HAS_RVALUE_REFS )
+++
+++// ... except in C++0x, move disables the implicit copy
+++
+++ shared_ptr( shared_ptr const & r ): px( r.px ), pn( r.pn ) // never throws
+++ {
+++ }
+++
+++#endif
++
++ template<class Y>
++ explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw
++--- misc/boost_1_44_0/boost/smart_ptr/weak_ptr.hpp 2009-12-14 18:44:19.000000000 +0100
+++++ misc/build/boost_1_44_0/boost/smart_ptr/weak_ptr.hpp 2012-03-28 10:31:57.607462325 +0200
++@@ -40,8 +40,24 @@
++ {
++ }
++
++-// generated copy constructor, assignment, destructor are fine
+++// generated copy constructor, assignment, destructor are fine...
++
+++#if defined( BOOST_HAS_RVALUE_REFS )
+++
+++// ... except in C++0x, move disables the implicit copy
+++
+++ weak_ptr( weak_ptr const & r ): px( r.px ), pn( r.pn ) // never throws
+++ {
+++ }
+++
+++ weak_ptr & operator=( weak_ptr const & r ) // never throws
+++ {
+++ px = r.px;
+++ pn = r.pn;
+++ return *this;
+++ }
+++
+++#endif
++
++ //
++ // The "obvious" converting constructor implementation:
+diff --git a/boost/makefile.mk b/boost/makefile.mk
+index 093566b..cab945f 100644
+--- a/boost/makefile.mk
++++ b/boost/makefile.mk
+@@ -71,6 +71,9 @@ PATCH_FILES+=boost.windows.patch
+
+ PATCH_FILES+=boost.windows.patch
+
++# Backporting fixes for the GCC 4.7 -std=c++11 mode from Boost 1.48.0:
++PATCH_FILES += boost_1_44_0-gcc4.7.patch
++
+ ADDITIONAL_FILES= \
+ libs/thread/src/win32/makefile.mk \
+ libs/date_time/src/gregorian/makefile.mk
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/patches/series b/patches/series
index c7f9509..1ccd0f2 100644
--- a/patches/series
+++ b/patches/series
@@ -31,3 +31,6 @@ pythonloader.uno.so-libpyuno-and-pyuno-are-duplicate.diff
armhf-bridges-doubles.diff
debian-hardened-buildflags.diff
gtk3-hack-explicit-gmodule.diff
+gcc-4.7.diff
+gcc-4.7-i386.diff
+gcc-4.7-amd64.diff
--
LibreOffice packaging repository
Reply to: