Make the iOS ARM code position-independent
This commit is contained in:
@@ -368,7 +368,11 @@ extern "C" void cpp_vtable_call(
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern int nFunIndexes, nVtableOffsets;
|
extern int nFunIndexes, nVtableOffsets;
|
||||||
|
#ifdef __arm
|
||||||
|
extern int codeSnippets[];
|
||||||
|
#else
|
||||||
extern unsigned char **codeSnippets;
|
extern unsigned char **codeSnippets;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char * codeSnippet(
|
unsigned char * codeSnippet(
|
||||||
@@ -389,7 +393,7 @@ unsigned char * codeSnippet(
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef __arm
|
#ifdef __arm
|
||||||
return 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;
|
int flag = 0;
|
||||||
|
@@ -33,10 +33,9 @@ sub gen_arm ($$)
|
|||||||
my ($funIndex, $vtableOffset) = @_;
|
my ($funIndex, $vtableOffset) = @_;
|
||||||
printf ("codeSnippet%08x%d:\n", $funIndex, $vtableOffset);
|
printf ("codeSnippet%08x%d:\n", $funIndex, $vtableOffset);
|
||||||
printf ("\tmov ip, pc\n");
|
printf ("\tmov ip, pc\n");
|
||||||
printf ("\tldr pc, [pc, #4]\n");
|
printf ("\tb _privateSnippetExecutor\n");
|
||||||
printf ("\t.long %#08x\n", $funIndex);
|
printf ("\t.long %#08x\n", $funIndex);
|
||||||
printf ("\t.long %d\n", $vtableOffset);
|
printf ("\t.long %d\n", $vtableOffset);
|
||||||
printf ("\t.long _privateSnippetExecutor\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub gen_x86 ($$$)
|
sub gen_x86 ($$$)
|
||||||
@@ -48,8 +47,6 @@ sub gen_x86 ($$$)
|
|||||||
printf ("\tjmp _privateSnippetExecutor%s\n", $executor);
|
printf ("\tjmp _privateSnippetExecutor%s\n", $executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("\t.text\n");
|
|
||||||
|
|
||||||
printf ("#ifdef __arm\n");
|
printf ("#ifdef __arm\n");
|
||||||
printf ("\t.align 4\n");
|
printf ("\t.align 4\n");
|
||||||
|
|
||||||
@@ -94,8 +91,8 @@ foreach my $funIndex (0 .. $nFunIndexes-1)
|
|||||||
foreach my $vtableOffset (0 .. $nVtableOffsets-1)
|
foreach my $vtableOffset (0 .. $nVtableOffsets-1)
|
||||||
{
|
{
|
||||||
printf ("#ifdef __arm\n");
|
printf ("#ifdef __arm\n");
|
||||||
printf ("\t.long codeSnippet%08x%d\n", $funIndex, $vtableOffset);
|
printf ("\t.long codeSnippet%08x%d - _codeSnippets\n", $funIndex, $vtableOffset);
|
||||||
printf ("\t.long codeSnippet%08x%d\n", $funIndex|0x80000000, $vtableOffset);
|
printf ("\t.long codeSnippet%08x%d - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset);
|
||||||
printf ("#else\n");
|
printf ("#else\n");
|
||||||
foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
|
foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class')
|
||||||
{
|
{
|
||||||
|
@@ -24,6 +24,9 @@
|
|||||||
* for a copy of the LGPLv3 License.
|
* for a copy of the LGPLv3 License.
|
||||||
*
|
*
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
#include "codesnippets.S"
|
||||||
|
|
||||||
#ifdef __arm
|
#ifdef __arm
|
||||||
@ ARM support code for LibreOffice C++/UNO bridging
|
@ ARM support code for LibreOffice C++/UNO bridging
|
||||||
@
|
@
|
||||||
@@ -35,7 +38,6 @@
|
|||||||
.file "helper.S"
|
.file "helper.S"
|
||||||
.text
|
.text
|
||||||
.align 4
|
.align 4
|
||||||
.globl _privateSnippetExecutor
|
|
||||||
|
|
||||||
_privateSnippetExecutor:
|
_privateSnippetExecutor:
|
||||||
stmfd sp!, {r0-r3} @ follow other parameters on stack
|
stmfd sp!, {r0-r3} @ follow other parameters on stack
|
||||||
@@ -53,7 +55,6 @@ _privateSnippetExecutor:
|
|||||||
.text
|
.text
|
||||||
|
|
||||||
.align 1, 0x90
|
.align 1, 0x90
|
||||||
.globl _privateSnippetExecutorGeneral
|
|
||||||
_privateSnippetExecutorGeneral:
|
_privateSnippetExecutorGeneral:
|
||||||
LFBg:
|
LFBg:
|
||||||
movl %esp,%ecx
|
movl %esp,%ecx
|
||||||
@@ -74,7 +75,6 @@ LFEg:
|
|||||||
.long .-_privateSnippetExecutorGeneral
|
.long .-_privateSnippetExecutorGeneral
|
||||||
|
|
||||||
.align 1, 0x90
|
.align 1, 0x90
|
||||||
.globl _privateSnippetExecutorVoid
|
|
||||||
_privateSnippetExecutorVoid:
|
_privateSnippetExecutorVoid:
|
||||||
LFBv:
|
LFBv:
|
||||||
movl %esp,%ecx
|
movl %esp,%ecx
|
||||||
@@ -94,7 +94,6 @@ LFEv:
|
|||||||
.long .-_privateSnippetExecutorVoid
|
.long .-_privateSnippetExecutorVoid
|
||||||
|
|
||||||
.align 1, 0x90
|
.align 1, 0x90
|
||||||
.globl _privateSnippetExecutorHyper
|
|
||||||
_privateSnippetExecutorHyper:
|
_privateSnippetExecutorHyper:
|
||||||
LFBh:
|
LFBh:
|
||||||
movl %esp,%ecx
|
movl %esp,%ecx
|
||||||
@@ -116,7 +115,6 @@ LFEh:
|
|||||||
.long .-_privateSnippetExecutorHyper
|
.long .-_privateSnippetExecutorHyper
|
||||||
|
|
||||||
.align 1, 0x90
|
.align 1, 0x90
|
||||||
.globl _privateSnippetExecutorFloat
|
|
||||||
_privateSnippetExecutorFloat:
|
_privateSnippetExecutorFloat:
|
||||||
LFBf:
|
LFBf:
|
||||||
movl %esp,%ecx
|
movl %esp,%ecx
|
||||||
@@ -137,7 +135,6 @@ LFEf:
|
|||||||
.long .-_privateSnippetExecutorFloat
|
.long .-_privateSnippetExecutorFloat
|
||||||
|
|
||||||
.align 1, 0x90
|
.align 1, 0x90
|
||||||
.globl _privateSnippetExecutorDouble
|
|
||||||
_privateSnippetExecutorDouble:
|
_privateSnippetExecutorDouble:
|
||||||
LFBd:
|
LFBd:
|
||||||
movl %esp,%ecx
|
movl %esp,%ecx
|
||||||
@@ -158,7 +155,6 @@ LFEd:
|
|||||||
.long .-_privateSnippetExecutorDouble
|
.long .-_privateSnippetExecutorDouble
|
||||||
|
|
||||||
.align 1, 0x90
|
.align 1, 0x90
|
||||||
.globl _privateSnippetExecutorClass
|
|
||||||
_privateSnippetExecutorClass:
|
_privateSnippetExecutorClass:
|
||||||
LFBc:
|
LFBc:
|
||||||
movl %esp,%ecx
|
movl %esp,%ecx
|
||||||
@@ -201,7 +197,6 @@ LSCIE1:
|
|||||||
.byte 1
|
.byte 1
|
||||||
.align 2
|
.align 2
|
||||||
LECIE1:
|
LECIE1:
|
||||||
.globl _privateSnippetExecutorGeneral.eh
|
|
||||||
_privateSnippetExecutorGeneral.eh:
|
_privateSnippetExecutorGeneral.eh:
|
||||||
LSFDEg:
|
LSFDEg:
|
||||||
.set L$set$g1,LEFDEg-LASFDEg
|
.set L$set$g1,LEFDEg-LASFDEg
|
||||||
@@ -224,7 +219,6 @@ LASFDEg:
|
|||||||
.byte 4
|
.byte 4
|
||||||
.align 2
|
.align 2
|
||||||
LEFDEg:
|
LEFDEg:
|
||||||
.globl _privateSnippetExecutorVoid.eh
|
|
||||||
_privateSnippetExecutorVoid.eh:
|
_privateSnippetExecutorVoid.eh:
|
||||||
LSFDEv:
|
LSFDEv:
|
||||||
.set L$set$v1,LEFDEv-LASFDEv
|
.set L$set$v1,LEFDEv-LASFDEv
|
||||||
@@ -247,7 +241,6 @@ LASFDEv:
|
|||||||
.byte 4
|
.byte 4
|
||||||
.align 2
|
.align 2
|
||||||
LEFDEv:
|
LEFDEv:
|
||||||
.globl _privateSnippetExecutorHyper.eh
|
|
||||||
_privateSnippetExecutorHyper.eh:
|
_privateSnippetExecutorHyper.eh:
|
||||||
LSFDEh:
|
LSFDEh:
|
||||||
.set L$set$h1,LEFDEh-LASFDEh
|
.set L$set$h1,LEFDEh-LASFDEh
|
||||||
@@ -270,7 +263,6 @@ LASFDEh:
|
|||||||
.byte 4
|
.byte 4
|
||||||
.align 2
|
.align 2
|
||||||
LEFDEh:
|
LEFDEh:
|
||||||
.globl _privateSnippetExecutorFloat.eh
|
|
||||||
_privateSnippetExecutorFloat.eh:
|
_privateSnippetExecutorFloat.eh:
|
||||||
LSFDEf:
|
LSFDEf:
|
||||||
.set L$set$f1,LEFDEf-LASFDEf
|
.set L$set$f1,LEFDEf-LASFDEf
|
||||||
@@ -293,7 +285,6 @@ LASFDEf:
|
|||||||
.byte 4
|
.byte 4
|
||||||
.align 2
|
.align 2
|
||||||
LEFDEf:
|
LEFDEf:
|
||||||
.globl _privateSnippetExecutorDouble.eh
|
|
||||||
_privateSnippetExecutorDouble.eh:
|
_privateSnippetExecutorDouble.eh:
|
||||||
LSFDEd:
|
LSFDEd:
|
||||||
.set L$set$d1,LEFDEd-LASFDEd
|
.set L$set$d1,LEFDEd-LASFDEd
|
||||||
@@ -316,7 +307,6 @@ LASFDEd:
|
|||||||
.byte 4
|
.byte 4
|
||||||
.align 2
|
.align 2
|
||||||
LEFDEd:
|
LEFDEd:
|
||||||
.globl _privateSnippetExecutorClass.eh
|
|
||||||
_privateSnippetExecutorClass.eh:
|
_privateSnippetExecutorClass.eh:
|
||||||
LSFDEc:
|
LSFDEc:
|
||||||
.set L$set$c1,LEFDEc-LASFDEc
|
.set L$set$c1,LEFDEc-LASFDEc
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
#
|
#
|
||||||
#*************************************************************************
|
#*************************************************************************
|
||||||
|
|
||||||
PRJ=..$/..$/..
|
PRJ=../../..
|
||||||
|
|
||||||
PRJNAME=bridges
|
PRJNAME=bridges
|
||||||
TARGET=gcc3_uno
|
TARGET=gcc3_uno
|
||||||
@@ -43,20 +43,19 @@ ENABLE_EXCEPTIONS=TRUE
|
|||||||
CFLAGSNOOPT=-O0
|
CFLAGSNOOPT=-O0
|
||||||
|
|
||||||
SLOFILES= \
|
SLOFILES= \
|
||||||
$(SLO)$/except.obj \
|
$(SLO)/except.obj \
|
||||||
$(SLO)$/cpp2uno.obj \
|
$(SLO)/cpp2uno.obj \
|
||||||
$(SLO)$/uno2cpp.obj \
|
$(SLO)/uno2cpp.obj \
|
||||||
$(SLO)$/codesnippets.obj \
|
$(SLO)/helper.obj
|
||||||
$(SLO)$/helper.obj
|
|
||||||
|
|
||||||
SHL1TARGET= $(TARGET)
|
SHL1TARGET= $(TARGET)
|
||||||
|
|
||||||
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
|
SHL1DEF=$(MISC)/$(SHL1TARGET).def
|
||||||
SHL1IMPLIB=i$(TARGET)
|
SHL1IMPLIB=i$(TARGET)
|
||||||
SHL1VERSIONMAP=..$/..$/bridge_exports.map
|
SHL1VERSIONMAP=../../bridge_exports.map
|
||||||
|
|
||||||
SHL1OBJS = $(SLOFILES)
|
SHL1OBJS = $(SLOFILES)
|
||||||
SHL1LIBS = $(SLB)$/cpp_uno_shared.lib
|
SHL1LIBS = $(SLB)/cpp_uno_shared.lib
|
||||||
SHL1RPATH = URELIB
|
SHL1RPATH = URELIB
|
||||||
|
|
||||||
SHL1STDLIBS= \
|
SHL1STDLIBS= \
|
||||||
@@ -68,10 +67,10 @@ SHL1STDLIBS= \
|
|||||||
|
|
||||||
.INCLUDE : target.mk
|
.INCLUDE : target.mk
|
||||||
|
|
||||||
$(SLO)$/%.obj: %.S
|
$(SLO)/helper.obj: helper.S $(MISC)/codesnippets.S generate-snippets.pl
|
||||||
$(CC) -c -o $(SLO)$/$(@:b).o $<
|
$(CC) -c -I $(MISC) -o $(SLO)/helper.o helper.S
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
codesnippets.S: generate-snippets.pl
|
$(MISC)/codesnippets.S: generate-snippets.pl
|
||||||
$(PERL) generate-snippets.pl >$@
|
$(PERL) generate-snippets.pl >$@
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user