From 1fde815769d3c1c7d3fcabe993e6b02ba3b86082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 9 Jul 2020 17:29:37 +0200 Subject: [PATCH 1/2] [ion/android] Do not setWindowStyle if SDL not initialized When a library was broken, we would see an error due to the failed setWindowStyle call, instead of getting the briken library error. --- .../src/java/com/numworks/calculator/EpsilonActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ion/src/simulator/android/src/java/com/numworks/calculator/EpsilonActivity.java b/ion/src/simulator/android/src/java/com/numworks/calculator/EpsilonActivity.java index 6a1c4f159..ef056c93e 100644 --- a/ion/src/simulator/android/src/java/com/numworks/calculator/EpsilonActivity.java +++ b/ion/src/simulator/android/src/java/com/numworks/calculator/EpsilonActivity.java @@ -74,7 +74,11 @@ public class EpsilonActivity extends SDLActivity { * setWindowStyle(false) was already called in SDLActivity::onCreate. Find * out why and make a proper fix? */ super.onCreate(savedInstanceState); - setWindowStyle(true); + if (!mBrokenLibraries) { + /* If mBrokenLibraries, SDL is not initialized by onCreate in + * SDLActivity.java. */ + setWindowStyle(true); + } } } From 2af89fb5468be68dfdc1188a8be2a1feb4451bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 9 Jul 2020 17:38:01 +0200 Subject: [PATCH 2/2] [build/android] Prevent code relocations in MicroPython --- build/toolchain.android.mak | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/toolchain.android.mak b/build/toolchain.android.mak index ed6762dbf..c22cfd1b3 100644 --- a/build/toolchain.android.mak +++ b/build/toolchain.android.mak @@ -34,6 +34,10 @@ CXX = $(NDK_TOOLCHAIN_PATH)/$(NDK_TARGET)$(NDK_VERSION)-clang++ LD = $(NDK_TOOLCHAIN_PATH)/$(NDK_TARGET)$(NDK_VERSION)-clang++ SFLAGS += -fPIC +# If MICROPY_NLR_SETJMP is 0, the MicroPython NLR is done by +# python/src/py/nlrthumb.c and creates code containing relocations, which is not +# accepted by Android. +SFLAGS += -DMICROPY_NLR_SETJMP=1 LDFLAGS += -shared LDFLAGS += -static-libstdc++