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( ...@@ -367,11 +367,7 @@ extern "C" void cpp_vtable_call(
//================================================================================================== //==================================================================================================
extern "C" { extern "C" {
extern int nFunIndexes, nVtableOffsets; extern int nFunIndexes, nVtableOffsets;
#ifdef __arm
extern int codeSnippets[]; extern int codeSnippets[];
#else
extern unsigned char **codeSnippets;
#endif
} }
unsigned char * codeSnippet( unsigned char * codeSnippet(
...@@ -395,7 +391,7 @@ unsigned char * codeSnippet( ...@@ -395,7 +391,7 @@ unsigned char * codeSnippet(
return ((unsigned char *) &codeSnippets) + codeSnippets[functionIndex*nVtableOffsets*2 + vtableOffset*2 + bHasHiddenParam]; return ((unsigned char *) &codeSnippets) + codeSnippets[functionIndex*nVtableOffsets*2 + vtableOffset*2 + bHasHiddenParam];
#else #else
enum { General, Void, Hyper, Float, Double, Class } exec; enum { General, Void, Hyper, Float, Double, Class } exec;
int flag = 0; bool bHasHiddenParam = false;
if (pReturnTypeRef == 0) { if (pReturnTypeRef == 0) {
exec = Void; exec = Void;
} }
...@@ -434,7 +430,7 @@ unsigned char * codeSnippet( ...@@ -434,7 +430,7 @@ unsigned char * codeSnippet(
case typelib_TypeClass_SEQUENCE: case typelib_TypeClass_SEQUENCE:
case typelib_TypeClass_INTERFACE: case typelib_TypeClass_INTERFACE:
case typelib_TypeClass_ANY: case typelib_TypeClass_ANY:
flag = 1; bHasHiddenParam = 1;
exec = Class; exec = Class;
break; break;
default: default:
...@@ -443,7 +439,12 @@ unsigned char * codeSnippet( ...@@ -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 #endif
} }
...@@ -548,6 +549,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( ...@@ -548,6 +549,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
void bridges::cpp_uno::shared::VtableFactory::flushCode( void bridges::cpp_uno::shared::VtableFactory::flushCode(
unsigned char const *, unsigned char const *) unsigned char const *, unsigned char const *)
{} {
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -52,7 +52,6 @@ using namespace ::rtl; ...@@ -52,7 +52,6 @@ using namespace ::rtl;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::__cxxabiv1; using namespace ::__cxxabiv1;
namespace CPPU_CURRENT_NAMESPACE namespace CPPU_CURRENT_NAMESPACE
{ {
...@@ -253,7 +252,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) ...@@ -253,7 +252,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception // destruct uno exception
::uno_any_destruct( pUnoExc, 0 ); ::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); rtti = (type_info *)RTTISingleton::get().getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr );
OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" );
......
...@@ -42,11 +42,13 @@ sub gen_x86 ($$$) ...@@ -42,11 +42,13 @@ sub gen_x86 ($$$)
{ {
my ($funIndex, $vtableOffset, $executor) = @_; my ($funIndex, $vtableOffset, $executor) = @_;
printf ("codeSnippet%08x%d%s:\n", $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 ("\tmovl \$%d, %%edx\n", $vtableOffset);
printf ("\tjmp _privateSnippetExecutor%s\n", $executor); printf ("\tjmp _privateSnippetExecutor%s\n", $executor);
} }
printf (".text\n");
printf ("#ifdef __arm\n"); printf ("#ifdef __arm\n");
printf ("\t.align 4\n"); printf ("\t.align 4\n");
...@@ -60,6 +62,7 @@ foreach my $funIndex (0 .. $nFunIndexes-1) ...@@ -60,6 +62,7 @@ foreach my $funIndex (0 .. $nFunIndexes-1)
} }
printf ("#else\n"); printf ("#else\n");
printf ("\t.align 1, 0x90\n");
foreach my $funIndex (0 .. $nFunIndexes-1) foreach my $funIndex (0 .. $nFunIndexes-1)
{ {
...@@ -96,8 +99,8 @@ foreach my $funIndex (0 .. $nFunIndexes-1) ...@@ -96,8 +99,8 @@ foreach my $funIndex (0 .. $nFunIndexes-1)
printf ("#else\n"); printf ("#else\n");
foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class') 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 - _codeSnippets\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|0x80000000, $vtableOffset, $executor);
} }
printf ("#endif\n"); printf ("#endif\n");
} }
......
...@@ -68,7 +68,7 @@ SHL1STDLIBS= \ ...@@ -68,7 +68,7 @@ SHL1STDLIBS= \
.INCLUDE : target.mk .INCLUDE : target.mk
$(SLO)/helper.obj: helper.S $(MISC)/codesnippets.S generate-snippets.pl $(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 $@ touch $@
$(MISC)/codesnippets.S: generate-snippets.pl $(MISC)/codesnippets.S: generate-snippets.pl
......
...@@ -450,7 +450,7 @@ namespace abi = __cxxabiv1; ...@@ -450,7 +450,7 @@ namespace abi = __cxxabiv1;
#endif // __RTTI_H #endif // __RTTI_H
// As this code is used both for the simulatos (x86) and device (ARM), // 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. // and in ../gcc3_linux_arm.
#ifdef __arm #ifdef __arm
...@@ -473,9 +473,10 @@ namespace CPPU_CURRENT_NAMESPACE ...@@ -473,9 +473,10 @@ namespace CPPU_CURRENT_NAMESPACE
__cxa_exception *nextException; __cxa_exception *nextException;
int handlerCount; int handlerCount;
#ifdef __ARM_EABI__ #ifdef __ARM_EABI__
__cxa_exception *nextPropagatingException; __cxa_exception *nextPropagatingException;
int propagationCount; int propagationCount;
#else #else
int handlerSwitchValue; int handlerSwitchValue;
const unsigned char *actionRecord; const unsigned char *actionRecord;
...@@ -545,6 +546,8 @@ struct __cxa_exception ...@@ -545,6 +546,8 @@ struct __cxa_exception
void *catchTemp; void *catchTemp;
void *adjustedPtr; void *adjustedPtr;
size_t referenceCount;
_Unwind_Exception unwindHeader; _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