Kaydet (Commit) 8d290f41 authored tarafından Pedro Giffuni's avatar Pedro Giffuni

Huge update to the FreeBSD port (amd64 part).

Starting with FreeBSD 10, the FreeBSD project has moved from using
gcc/libstdc++ to using a complete C++ stack based on clang/llvm
libc++ and libcxxrt. This new stack has better standards compliance
and has huge similarities with MacOSX but it brought subtle low
level problems for our outdated bridges code.

Don Lewis has done a brave effort to update this code and
has done extensive testing within FreeBSD port. Support
for older versions of gcc has been dropped.

Code Review:
https://reviews.freebsd.org/D2108
https://reviews.freebsd.org/D2055

Author:		Don Lewis (truckman at FreeBSD)
üst 5bffd35f
......@@ -24,9 +24,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
#include <stdio.h>
#include <stdlib.h>
#include <hash_map>
#include <typeinfo>
#include <exception>
#include <cstddef>
#include <cxxabi.h>
#include <rtl/alloc.h>
#include <osl/mutex.hxx>
......
......@@ -24,9 +24,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
#include <cstddef>
#include <exception>
#endif
#include <typeinfo>
#include <stdio.h>
#include <string.h>
......@@ -182,7 +182,12 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
char const * rttiName = symName.getStr() +4;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
#ifndef __GLIBCXX__ /* #i124421# */
const OString aCUnoName = OUStringToOString( unoName, RTL_TEXTENCODING_UTF8);
OSL_TRACE( "TypeInfo for \"%s\" not found and cannot be generated.\n", aCUnoName.getStr());
#endif /* __GLIBCXX__ */
#endif
#ifdef __GLIBCXX__ /* #i124421# */
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
......@@ -196,6 +201,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
// this class has no base class
rtti = new __class_type_info( strdup( rttiName ) );
}
#else /* __GLIBCXX__ */
rtti = NULL;
#endif /* __GLIBCXX__ */
pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
......
......@@ -23,10 +23,6 @@
#include "uno/mapping.h"
#include <typeinfo>
#include <exception>
#include <cstddef>
namespace CPPU_CURRENT_NAMESPACE
{
......@@ -34,6 +30,7 @@ void dummy_can_throw_anything( char const * );
// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
#ifdef __GLIBCXX__
struct _Unwind_Exception
{
unsigned exception_class __attribute__((__mode__(__DI__)));
......@@ -62,18 +59,21 @@ struct __cxa_exception
_Unwind_Exception unwindHeader;
};
#endif /* __GLIBCXX__ */
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));
#ifdef __GLIBCXX__
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
};
extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
#endif /* __GLIBCXX__ */
// -----
......@@ -81,6 +81,10 @@ extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
//==================================================================================================
#ifndef __GLIBCXX__
using __cxxabiv1:: __cxa_exception;
#endif /* __GLIBCXX__ */
void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
......@@ -24,9 +24,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
#include <exception>
#include <typeinfo>
#include <stdio.h>
#include <exception>
#include <cstddef>
#include <cxxabi.h>
#include <stdlib.h>
#include <string.h>
......@@ -47,6 +48,11 @@
using namespace ::rtl;
using namespace ::com::sun::star::uno;
#ifdef __GLIBCXX__
using CPPU_CURRENT_NAMESPACE::__cxa_get_globals;
#else
using __cxxabiv1::__cxa_get_globals;
#endif
//==================================================================================================
static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
......@@ -446,7 +452,7 @@ static void cpp_call(
catch (...)
{
// fill uno exception
fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
CPPU_CURRENT_NAMESPACE::fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
// temporary params
for ( ; nTempIndizes--; )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment