Kaydet (Commit) 4067e629 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

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.
üst 83ba7b4e
......@@ -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: */
......@@ -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!" );
......
......@@ -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");
}
......
......@@ -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
......
......@@ -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;
};
......
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