[Libreoffice-commits] core.git: 3 commits - bridges/source ios/LibreOfficeLight

jan Iversen jani at libreoffice.org
Sun Mar 11 18:09:44 UTC 2018


 bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx                     |   44 ++++++--
 bridges/source/cpp_uno/gcc3_ios/ios64_helper.s                  |   36 ------
 ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj |   52 ++++++++++
 3 files changed, 88 insertions(+), 44 deletions(-)

New commits:
commit 814bd40070db654d80a16d9f813610cae3b12dd6
Author: jan Iversen <jani at libreoffice.org>
Date:   Sun Mar 11 19:05:09 2018 +0100

    iOS, calling cpp_vtable_call does not corrupt stack
    
    Changing bl -> b (jump long to jump) allowed cpp_vtable_call
    to work without corrumping the stack.
    
    However return still corrumpts the stack.
    
    Change-Id: I3437a73139b65af13dcf6fa0c959bb1c847564b9

diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index 1250beedbcda..98d859c69cde 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -56,11 +56,11 @@ extern "C" void privateSnippetExecutor()
          // Second argument: The pointer to all the above
          "       mov     x1, sp\n"
 
-         "       bl      _cpp_vtable_call\n"
+         "       b       _cpp_vtable_call\n"
 
          "       ldp     x8, lr, [sp, #0]\n"
          "       add     sp, sp, #144\n"
-         "       ret     lr\n"
+//         "       ret     lr\n"
     );
 }
 
commit a414d362350df8eacd82104545a6aaf4ce102011
Author: jan Iversen <jani at libreoffice.org>
Date:   Sun Mar 11 18:22:38 2018 +0100

    iOS, updated xcode project file
    
    the only change is that addition of files needed to debug the
    stack corruption problem.
    
    Change-Id: I3598cdba2e84f51a3a90387dbe3439eafb34f878

diff --git a/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj b/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj
index e02182b1d8e7..c702cef65d22 100644
--- a/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj
+++ b/ios/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj
@@ -93,6 +93,24 @@
 		39E950521FC9842000D82C49 /* source */ = {isa = PBXFileReference; lastKnownFileType = folder; name = source; path = ../source; sourceTree = "<group>"; };
 		39EE81531FA644E800B73AB8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		39EF4E2E1FA500C9001914AC /* PropertiesController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PropertiesController.swift; sourceTree = "<group>"; };
+		39FD89C9204E87E900E7179F /* except.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = except.cxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx"; sourceTree = "<group>"; };
+		39FD89CB204E87FD00E7179F /* except.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = except.cxx; path = ../../bridges/source/cpp_uno/gcc3_ios/except.cxx; sourceTree = "<group>"; };
+		39FD89CF204E8EB900E7179F /* cpp2uno.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpp2uno.cxx; path = ../../bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx; sourceTree = "<group>"; };
+		39FD89D1204E8ED000E7179F /* share.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = share.hxx; path = ../../bridges/source/cpp_uno/gcc3_ios/share.hxx; sourceTree = "<group>"; };
+		39FD89D2204E8ED000E7179F /* unwind-cxx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "unwind-cxx.h"; path = "../../bridges/source/cpp_uno/gcc3_ios/unwind-cxx.h"; sourceTree = "<group>"; };
+		39FD89D3204E8ED000E7179F /* rtti.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rtti.h; path = ../../bridges/source/cpp_uno/gcc3_ios/rtti.h; sourceTree = "<group>"; };
+		39FD89D4204E8ED000E7179F /* ios64_helper.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = ios64_helper.s; path = ../../bridges/source/cpp_uno/gcc3_ios/ios64_helper.s; sourceTree = "<group>"; };
+		39FD89D5204E8ED000E7179F /* uno2cpp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = uno2cpp.cxx; path = ../../bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx; sourceTree = "<group>"; };
+		39FD89D8204E8EEE00E7179F /* call.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = call.cxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/call.cxx"; sourceTree = "<group>"; };
+		39FD89D9204E8EEE00E7179F /* abi.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = abi.cxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx"; sourceTree = "<group>"; };
+		39FD89DA204E8EEE00E7179F /* uno2cpp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = uno2cpp.cxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx"; sourceTree = "<group>"; };
+		39FD89DB204E8EEE00E7179F /* share.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = share.hxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/share.hxx"; sourceTree = "<group>"; };
+		39FD89DC204E8EEE00E7179F /* call.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = call.hxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/call.hxx"; sourceTree = "<group>"; };
+		39FD89DD204E8EEE00E7179F /* abi.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = abi.hxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.hxx"; sourceTree = "<group>"; };
+		39FD89DE204E8EEE00E7179F /* callvirtualmethod.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = callvirtualmethod.cxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/callvirtualmethod.cxx"; sourceTree = "<group>"; };
+		39FD89DF204E8EEF00E7179F /* cpp2uno.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cpp2uno.cxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx"; sourceTree = "<group>"; };
+		39FD89E0204E8EEF00E7179F /* callvirtualmethod.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = callvirtualmethod.hxx; path = "../../bridges/source/cpp_uno/gcc3_macosx_x86-64/callvirtualmethod.hxx"; sourceTree = "<group>"; };
+		39FD89E6204EBCB900E7179F /* exc_thrower.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = exc_thrower.cxx; path = ../../cppuhelper/source/exc_thrower.cxx; sourceTree = "<group>"; };
 		FC31D01D2012F65500E7F402 /* DocumentHolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentHolder.swift; sourceTree = "<group>"; };
 		FC31D01F2012F6D300E7F402 /* RenderCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RenderCache.swift; sourceTree = "<group>"; };
 		FC31D02A2013500E00E7F402 /* ButtonScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonScrollView.swift; sourceTree = "<group>"; };
@@ -134,6 +152,9 @@
 		3956B72D1FAB3DBF00BF5DE4 /* extra */ = {
 			isa = PBXGroup;
 			children = (
+				39FD89E6204EBCB900E7179F /* exc_thrower.cxx */,
+				39FD89CE204E8E6500E7179F /* ipad */,
+				39FD89CD204E8E5E00E7179F /* sim */,
 				39E950521FC9842000D82C49 /* source */,
 			);
 			name = extra;
@@ -211,6 +232,37 @@
 			name = Resources;
 			sourceTree = SOURCE_ROOT;
 		};
+		39FD89CD204E8E5E00E7179F /* sim */ = {
+			isa = PBXGroup;
+			children = (
+				39FD89D9204E8EEE00E7179F /* abi.cxx */,
+				39FD89DD204E8EEE00E7179F /* abi.hxx */,
+				39FD89D8204E8EEE00E7179F /* call.cxx */,
+				39FD89DC204E8EEE00E7179F /* call.hxx */,
+				39FD89DE204E8EEE00E7179F /* callvirtualmethod.cxx */,
+				39FD89E0204E8EEF00E7179F /* callvirtualmethod.hxx */,
+				39FD89DF204E8EEF00E7179F /* cpp2uno.cxx */,
+				39FD89DB204E8EEE00E7179F /* share.hxx */,
+				39FD89DA204E8EEE00E7179F /* uno2cpp.cxx */,
+				39FD89C9204E87E900E7179F /* except.cxx */,
+			);
+			name = sim;
+			sourceTree = "<group>";
+		};
+		39FD89CE204E8E6500E7179F /* ipad */ = {
+			isa = PBXGroup;
+			children = (
+				39FD89D4204E8ED000E7179F /* ios64_helper.s */,
+				39FD89D3204E8ED000E7179F /* rtti.h */,
+				39FD89D1204E8ED000E7179F /* share.hxx */,
+				39FD89D5204E8ED000E7179F /* uno2cpp.cxx */,
+				39FD89D2204E8ED000E7179F /* unwind-cxx.h */,
+				39FD89CF204E8EB900E7179F /* cpp2uno.cxx */,
+				39FD89CB204E87FD00E7179F /* except.cxx */,
+			);
+			name = ipad;
+			sourceTree = "<group>";
+		};
 		FCC2E3F52004A01400CEB504 /* LOKit */ = {
 			isa = PBXGroup;
 			children = (
commit 056bc3cf26e539f4e841aeeecc8f1badff7ddc37
Author: jan Iversen <jani at libreoffice.org>
Date:   Sun Mar 11 18:18:57 2018 +0100

    iOS, moved privateSnippetExecutor from asm to C function.
    
    move asm code to C as first step towards reducing the asm code.
    Since iOS does not permit java/python or anything else than the
    compiled C++ code, the throw should be done simpler.
    
    Apart from that this is the first step in solving a stack
    corruption problem in the throw code
    
    Change-Id: I4f3d3a3ba3f55fb46131d9a8eeb0deebf179d95f

diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index 17ed29f60789..1250beedbcda 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -17,14 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-// For iOS devices (64-bit ARM). Originally a copy of
-// ../gcc3_linux_arm/cpp2uno.cxx.
-
-// No attempts at factoring out the large amounts of more or less
-// common code in this, cpp2uno-arm.cxx and cpp2uno-i386.cxx have been
-// done. Which is sad. But then the whole bridges/source/cpp_uno is
-// full of copy/paste. So I continue in that tradition...
-
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <sal/log.hxx>
 #include <uno/data.h>
@@ -37,6 +29,42 @@
 
 #include "share.hxx"
 
+
+// Snippet code done inline
+extern "C" void privateSnippetExecutor()
+{
+    // _privateSnippetExecutor is jumped to from each codeSnippet_*
+    asm volatile (
+         // Store potential args in general purpose registers
+         "       stp     x6, x7, [sp, #-16]!\n"
+         "       stp     x4, x5, [sp, #-16]!\n"
+         "       stp     x2, x3, [sp, #-16]!\n"
+         "       stp     x0, x1, [sp, #-16]!\n"
+
+         // Store potential args in floating point/SIMD registers
+         "       stp     d6, d7, [sp, #-16]!\n"
+         "       stp     d4, d5, [sp, #-16]!\n"
+         "       stp     d2, d3, [sp, #-16]!\n"
+         "       stp     d0, d1, [sp, #-16]!\n"
+
+         // First argument to cpp_vtable_call: The x15 set up in the codeSnippet instance
+         "       mov     x0, x15\n"
+
+         // Store x8 (potential pointer to return value storage) and lr
+         "       stp     x8, lr, [sp, #-16]!\n"
+
+         // Second argument: The pointer to all the above
+         "       mov     x1, sp\n"
+
+         "       bl      _cpp_vtable_call\n"
+
+         "       ldp     x8, lr, [sp, #0]\n"
+         "       add     sp, sp, #144\n"
+         "       ret     lr\n"
+    );
+}
+
+
 extern "C" {
     extern int nFunIndexes, nVtableOffsets;
     extern int codeSnippets[];
diff --git a/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s b/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s
index 6e6e8c74b347..14a62a012e11 100644
--- a/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s
+++ b/bridges/source/cpp_uno/gcc3_ios/ios64_helper.s
@@ -221,40 +221,4 @@ _codeSnippets:
     .long codeSnippet_00000007_3 - _codeSnippets
 
 
-
-    .text
-    .align 4
-
-_privateSnippetExecutor:
-
-    .cfi_startproc
-    // _privateSnippetExecutor is jumped to from each of the
-    // codeSnippet_*  generated by generate-snippets.pl
-
-    // Store potential args in general purpose registers
-    stp     x6, x7, [sp, #-16]!
-    stp     x4, x5, [sp, #-16]!
-    stp     x2, x3, [sp, #-16]!
-    stp     x0, x1, [sp, #-16]!
-
-    // Store potential args in floating point/SIMD registers
-    stp     d6, d7, [sp, #-16]!
-    stp     d4, d5, [sp, #-16]!
-    stp     d2, d3, [sp, #-16]!
-    stp     d0, d1, [sp, #-16]!
-
-    // First argument to cpp_vtable_call: The x15 set up in the codeSnippet instance
-    mov     x0, x15
-    // Store x8 (potential pointer to return value storage) and lr
-    stp     x8, lr, [sp, #-16]!
-    // Second argument: The pointer to all the above
-    mov     x1, sp
-
-    bl      _cpp_vtable_call
-
-    ldp     x8, lr, [sp, #0]
-    add     sp, sp, #144
-    ret     lr
-    .cfi_endproc
-
 // vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list