diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-03-05 01:24:47 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-03-05 02:05:26 +0200 |
commit | cc9b1e4e41f4c958efbe68b931cd0f1010b2a104 (patch) | |
tree | 7206cc27c1d76038dd50dedf426ecb92aa48647e /bridges | |
parent | 8574b1f5b525bd924e6453dc64525faebfd1c4da (diff) |
Make the iOS ARM code position-independent
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx | 8 | ||||
-rwxr-xr-x | bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl | 9 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_ios_arm/helper.S | 16 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk | 23 |
4 files changed, 23 insertions, 33 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx index e225a5675b58..8b9e130b66e8 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno.cxx @@ -368,7 +368,11 @@ extern "C" void cpp_vtable_call( extern "C" { extern int nFunIndexes, nVtableOffsets; -extern unsigned char **codeSnippets; +#ifdef __arm +extern int codeSnippets[]; +#else +extern unsigned char **codeSnippets; +#endif } unsigned char * codeSnippet( @@ -389,7 +393,7 @@ unsigned char * codeSnippet( return NULL; #ifdef __arm - return codeSnippets[functionIndex*nVtableOffsets*2 + vtableOffset*2 + bHasHiddenParam]; + return ((unsigned char *) &codeSnippets) + codeSnippets[functionIndex*nVtableOffsets*2 + vtableOffset*2 + bHasHiddenParam]; #else enum { General, Void, Hyper, Float, Double, Class } exec; int flag = 0; 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 4fe9f2fe4021..b6bd0e9ffd7f 100755 --- a/bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl +++ b/bridges/source/cpp_uno/gcc3_ios_arm/generate-snippets.pl @@ -33,10 +33,9 @@ sub gen_arm ($$) my ($funIndex, $vtableOffset) = @_; printf ("codeSnippet%08x%d:\n", $funIndex, $vtableOffset); printf ("\tmov ip, pc\n"); - printf ("\tldr pc, [pc, #4]\n"); + printf ("\tb _privateSnippetExecutor\n"); printf ("\t.long %#08x\n", $funIndex); printf ("\t.long %d\n", $vtableOffset); - printf ("\t.long _privateSnippetExecutor\n"); } sub gen_x86 ($$$) @@ -48,8 +47,6 @@ sub gen_x86 ($$$) printf ("\tjmp _privateSnippetExecutor%s\n", $executor); } -printf ("\t.text\n"); - printf ("#ifdef __arm\n"); printf ("\t.align 4\n"); @@ -94,8 +91,8 @@ foreach my $funIndex (0 .. $nFunIndexes-1) foreach my $vtableOffset (0 .. $nVtableOffsets-1) { printf ("#ifdef __arm\n"); - printf ("\t.long codeSnippet%08x%d\n", $funIndex, $vtableOffset); - printf ("\t.long codeSnippet%08x%d\n", $funIndex|0x80000000, $vtableOffset); + printf ("\t.long codeSnippet%08x%d - _codeSnippets\n", $funIndex, $vtableOffset); + printf ("\t.long codeSnippet%08x%d - _codeSnippets\n", $funIndex|0x80000000, $vtableOffset); printf ("#else\n"); foreach my $executor ('General', 'Void', 'Hyper', 'Float', 'Double', 'Class') { diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/helper.S b/bridges/source/cpp_uno/gcc3_ios_arm/helper.S index 5a620b617b39..9c5ada3d6c35 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/helper.S +++ b/bridges/source/cpp_uno/gcc3_ios_arm/helper.S @@ -24,6 +24,9 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ + +#include "codesnippets.S" + #ifdef __arm @ ARM support code for LibreOffice C++/UNO bridging @ @@ -35,7 +38,6 @@ .file "helper.S" .text .align 4 - .globl _privateSnippetExecutor _privateSnippetExecutor: stmfd sp!, {r0-r3} @ follow other parameters on stack @@ -53,7 +55,6 @@ _privateSnippetExecutor: .text .align 1, 0x90 -.globl _privateSnippetExecutorGeneral _privateSnippetExecutorGeneral: LFBg: movl %esp,%ecx @@ -74,7 +75,6 @@ LFEg: .long .-_privateSnippetExecutorGeneral .align 1, 0x90 -.globl _privateSnippetExecutorVoid _privateSnippetExecutorVoid: LFBv: movl %esp,%ecx @@ -94,7 +94,6 @@ LFEv: .long .-_privateSnippetExecutorVoid .align 1, 0x90 -.globl _privateSnippetExecutorHyper _privateSnippetExecutorHyper: LFBh: movl %esp,%ecx @@ -116,7 +115,6 @@ LFEh: .long .-_privateSnippetExecutorHyper .align 1, 0x90 -.globl _privateSnippetExecutorFloat _privateSnippetExecutorFloat: LFBf: movl %esp,%ecx @@ -137,7 +135,6 @@ LFEf: .long .-_privateSnippetExecutorFloat .align 1, 0x90 -.globl _privateSnippetExecutorDouble _privateSnippetExecutorDouble: LFBd: movl %esp,%ecx @@ -158,7 +155,6 @@ LFEd: .long .-_privateSnippetExecutorDouble .align 1, 0x90 -.globl _privateSnippetExecutorClass _privateSnippetExecutorClass: LFBc: movl %esp,%ecx @@ -201,7 +197,6 @@ LSCIE1: .byte 1 .align 2 LECIE1: - .globl _privateSnippetExecutorGeneral.eh _privateSnippetExecutorGeneral.eh: LSFDEg: .set L$set$g1,LEFDEg-LASFDEg @@ -224,7 +219,6 @@ LASFDEg: .byte 4 .align 2 LEFDEg: - .globl _privateSnippetExecutorVoid.eh _privateSnippetExecutorVoid.eh: LSFDEv: .set L$set$v1,LEFDEv-LASFDEv @@ -247,7 +241,6 @@ LASFDEv: .byte 4 .align 2 LEFDEv: - .globl _privateSnippetExecutorHyper.eh _privateSnippetExecutorHyper.eh: LSFDEh: .set L$set$h1,LEFDEh-LASFDEh @@ -270,7 +263,6 @@ LASFDEh: .byte 4 .align 2 LEFDEh: - .globl _privateSnippetExecutorFloat.eh _privateSnippetExecutorFloat.eh: LSFDEf: .set L$set$f1,LEFDEf-LASFDEf @@ -293,7 +285,6 @@ LASFDEf: .byte 4 .align 2 LEFDEf: - .globl _privateSnippetExecutorDouble.eh _privateSnippetExecutorDouble.eh: LSFDEd: .set L$set$d1,LEFDEd-LASFDEd @@ -316,7 +307,6 @@ LASFDEd: .byte 4 .align 2 LEFDEd: - .globl _privateSnippetExecutorClass.eh _privateSnippetExecutorClass.eh: LSFDEc: .set L$set$c1,LEFDEc-LASFDEc diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk b/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk index 8854280a1708..e3c48ead8ce3 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk +++ b/bridges/source/cpp_uno/gcc3_ios_arm/makefile.mk @@ -25,7 +25,7 @@ # #************************************************************************* -PRJ=..$/..$/.. +PRJ=../../.. PRJNAME=bridges TARGET=gcc3_uno @@ -43,20 +43,19 @@ ENABLE_EXCEPTIONS=TRUE CFLAGSNOOPT=-O0 SLOFILES= \ - $(SLO)$/except.obj \ - $(SLO)$/cpp2uno.obj \ - $(SLO)$/uno2cpp.obj \ - $(SLO)$/codesnippets.obj \ - $(SLO)$/helper.obj + $(SLO)/except.obj \ + $(SLO)/cpp2uno.obj \ + $(SLO)/uno2cpp.obj \ + $(SLO)/helper.obj SHL1TARGET= $(TARGET) -SHL1DEF=$(MISC)$/$(SHL1TARGET).def +SHL1DEF=$(MISC)/$(SHL1TARGET).def SHL1IMPLIB=i$(TARGET) -SHL1VERSIONMAP=..$/..$/bridge_exports.map +SHL1VERSIONMAP=../../bridge_exports.map SHL1OBJS = $(SLOFILES) -SHL1LIBS = $(SLB)$/cpp_uno_shared.lib +SHL1LIBS = $(SLB)/cpp_uno_shared.lib SHL1RPATH = URELIB SHL1STDLIBS= \ @@ -68,10 +67,10 @@ SHL1STDLIBS= \ .INCLUDE : target.mk -$(SLO)$/%.obj: %.S - $(CC) -c -o $(SLO)$/$(@:b).o $< +$(SLO)/helper.obj: helper.S $(MISC)/codesnippets.S generate-snippets.pl + $(CC) -c -I $(MISC) -o $(SLO)/helper.o helper.S touch $@ -codesnippets.S: generate-snippets.pl +$(MISC)/codesnippets.S: generate-snippets.pl $(PERL) generate-snippets.pl >$@ |