summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-04-15 01:36:27 +0200
committerTor Lillqvist <tml@iki.fi>2012-04-15 11:56:48 +0200
commit4067e629f7fc9e93b8eb36fffc5fdcc0c3fa8906 (patch)
tree9ba6aaaf88f8db2d3fd46d865115de6a69c45493 /bridges
parent83ba7b4e8f67cc3a21fbaf476621af509032ae47 (diff)
Fix crasher and generate PIC for iOS simulator
Had an embarrassing thinko in the assembler generation for the iOS simulator, had forgotten the $ for a literal number. While at it, make also the simulator read-only code snippet data structures position-independent. Some minor comment improvements. Bridge seems to work now on simulator.
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx18
-rw-r--r--bridges/source/cpp_uno/gcc3_ios_arm/except.cxx2
-rwxr-xr-xbridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl9
-rw-r--r--bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk2
-rw-r--r--bridges/source/cpp_uno/gcc3_ios_arm/share.hxx9
5 files changed, 23 insertions, 17 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx
index 12e9d971c655..9e6fba0dfc50 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx
@@ -367,11 +367,7 @@ extern "C" void cpp_vtable_call(
//==================================================================================================
extern "C" {
extern int nFunIndexes, nVtableOffsets;
-#ifdef __arm
extern int codeSnippets[];
-#else
-extern unsigned char **codeSnippets;
-#endif
}
unsigned char * codeSnippet(
@@ -395,7 +391,7 @@ unsigned char * codeSnippet(
return ((unsigned char *) &codeSnippets) + codeSnippets[functionIndex*nVtableOffsets*2 + vtableOffset*2 + bHasHiddenParam];
#else
enum { General, Void, Hyper, Float, Double, Class } exec;
- int flag = 0;
+ bool bHasHiddenParam = false;
if (pReturnTypeRef == 0) {
exec = Void;
}
@@ -434,7 +430,7 @@ unsigned char * codeSnippet(
case typelib_TypeClass_SEQUENCE:
case typelib_TypeClass_INTERFACE:
case typelib_TypeClass_ANY:
- flag = 1;
+ bHasHiddenParam = 1;
exec = Class;
break;
default:
@@ -443,7 +439,12 @@ unsigned char * codeSnippet(
}
}
- return codeSnippets[functionIndex*nVtableOffsets*6*2 + vtableOffset*6*2 + exec*2 + flag];
+ // The codeSnippets table is indexed by functionIndex, vtableOffset, exec and flag
+
+ fprintf(stderr, "Indexing codeSnippets with %ld [%ld,%ld,%d,%d]\n",
+ functionIndex*nVtableOffsets*6*2 + vtableOffset*6*2 + exec*2 + bHasHiddenParam,
+ functionIndex, vtableOffset, (int) exec, bHasHiddenParam);
+ return ((unsigned char *) &codeSnippets) + codeSnippets[functionIndex*nVtableOffsets*6*2 + vtableOffset*6*2 + exec*2 + bHasHiddenParam];
#endif
}
@@ -548,6 +549,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
void bridges::cpp_uno::shared::VtableFactory::flushCode(
unsigned char const *, unsigned char const *)
-{}
+{
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
index f28d9e294841..eba5d13c8c76 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx
@@ -52,7 +52,6 @@ using namespace ::rtl;
using namespace ::com::sun::star::uno;
using namespace ::__cxxabiv1;
-
namespace CPPU_CURRENT_NAMESPACE
{
@@ -253,7 +252,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
- // avoiding locked counts
rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr );
OSL_ENSURE( rtti, "### no rtti for throwing exception!" );
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl b/bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl
index b6bd0e9ffd7f..2e6d6fefaead 100755
--- a/bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl
@@ -42,11 +42,13 @@ sub gen_x86 ($$$)
{
my ($funIndex, $vtableOffset, $executor) = @_;
printf ("codeSnippet%08x%d%s:\n", $funIndex, $vtableOffset, $executor);
- printf ("\tmovl %#08x, %%eax\n", $funIndex);
+ printf ("\tmovl \$%#08x, %%eax\n", $funIndex);
printf ("\tmovl \$%d, %%edx\n", $vtableOffset);
printf ("\tjmp _privateSnippetExecutor%s\n", $executor);
}
+printf (".text\n");
+
printf ("#ifdef __arm\n");
printf ("\t.align 4\n");
@@ -60,6 +62,7 @@ foreach my $funIndex (0 .. $nFunIndexes-1)
}
printf ("#else\n");
+printf ("\t.align 1, 0x90\n");
foreach my $funIndex (0 .. $nFunIndexes-1)
{
@@ -96,8 +99,8 @@ foreach my $funIndex (0 .. $nFunIndexes-1)
printf ("#else\n");
foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
{
- printf ("\t.long codeSnippet%08x%d%s\n", $funIndex, $vtableOffset, $executor);
- printf ("\t.long codeSnippet%08x%d%s\n", $funIndex|0x80000000, $vtableOffset, $executor);
+ printf ("\t.long codeSnippet%08x%d%s - _codeSnippets\n", $funIndex, $vtableOffset, $executor);
+ printf ("\t.long codeSnippet%08x%d%s - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset, $executor);
}
printf ("#endif\n");
}
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk b/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk
index e3c48ead8ce3..e38399cd84f7 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk
@@ -68,7 +68,7 @@ SHL1STDLIBS= \
.INCLUDE : target.mk
$(SLO)/helper.obj: helper.S $(MISC)/codesnippets.S generate-snippets.pl
- $(CC) -c -I $(MISC) -o $(SLO)/helper.o helper.S
+ $(CC) $(CFLAGS) -c -I $(MISC) -o $(SLO)/helper.o helper.S
touch $@
$(MISC)/codesnippets.S: generate-snippets.pl
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/share.hxx b/bridges/source/cpp_uno/gcc3_ios_arm/share.hxx
index 61cb47476f42..06692bf7e086 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/share.hxx
@@ -450,7 +450,7 @@ namespace abi = __cxxabiv1;
#endif // __RTTI_H
// As this code is used both for the simulatos (x86) and device (ARM),
-// this file is a combination of the share.hxx in ../gcc3_linux_intel
+// this file is a combination of the share.hxx in ../gcc3_macosx_intel
// and in ../gcc3_linux_arm.
#ifdef __arm
@@ -473,9 +473,10 @@ namespace CPPU_CURRENT_NAMESPACE
__cxa_exception *nextException;
int handlerCount;
+
#ifdef __ARM_EABI__
- __cxa_exception *nextPropagatingException;
- int propagationCount;
+ __cxa_exception *nextPropagatingException;
+ int propagationCount;
#else
int handlerSwitchValue;
const unsigned char *actionRecord;
@@ -545,6 +546,8 @@ struct __cxa_exception
void *catchTemp;
void *adjustedPtr;
+ size_t referenceCount;
+
_Unwind_Exception unwindHeader;
};