diff --git a/backend.native/konan.properties b/backend.native/konan.properties index 8cf1b971328..1271ac968da 100644 --- a/backend.native/konan.properties +++ b/backend.native/konan.properties @@ -138,7 +138,7 @@ libffiDir.raspberrypi = libffi-3.2.1-2-raspberrypi linkerKonanFlags.raspberrypi = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread # targetSysroot-relative. libGcc.raspberrypi = lib/gcc/arm-linux-gnueabihf/4.8.3 -llvmLtoFlags.raspberrypi = +llvmLtoFlags.raspberrypi = -float-abi=hard -mcpu=arm1136jf-s llvmLtoOptFlags.raspberrypi = -O3 -function-sections llvmLtoNooptFlags.raspberrypi = -O1 dynamicLinker.raspberrypi = /lib/ld-linux-armhf.so.3 diff --git a/runtime/src/main/cpp/ObjCInterop.cpp b/runtime/src/main/cpp/ObjCInterop.cpp index 20ce8366765..ca85fd5def5 100644 --- a/runtime/src/main/cpp/ObjCInterop.cpp +++ b/runtime/src/main/cpp/ObjCInterop.cpp @@ -243,6 +243,7 @@ void Kotlin_objc_release(void* ptr) { void* Kotlin_objc_lookUpClass(const char* name) { RuntimeAssert(false, "Objective-C interop is disabled"); + return nullptr; } } // extern "C" diff --git a/runtime/src/main/cpp/dtoa/dblparse.cpp b/runtime/src/main/cpp/dtoa/dblparse.cpp index 315ea3d513f..4e1834048a2 100644 --- a/runtime/src/main/cpp/dtoa/dblparse.cpp +++ b/runtime/src/main/cpp/dtoa/dblparse.cpp @@ -17,13 +17,13 @@ #include #include +#include + #include "cbigint.h" +#include "../Exceptions.h" #include "../KString.h" #include "../Natives.h" -#include "../Exceptions.h" #include "../utf8.h" -#include -#include #if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX) #define USE_LL diff --git a/runtime/src/main/cpp/dtoa/fltparse.cpp b/runtime/src/main/cpp/dtoa/fltparse.cpp index 26eb4d52a45..cd26c2e534f 100644 --- a/runtime/src/main/cpp/dtoa/fltparse.cpp +++ b/runtime/src/main/cpp/dtoa/fltparse.cpp @@ -17,13 +17,13 @@ #include #include +#include + #include "cbigint.h" +#include "../Exceptions.h" #include "../KString.h" #include "../Natives.h" -#include "../Exceptions.h" #include "../utf8.h" -#include -#include #if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(ZOS) || defined(AIX) #define USE_LL @@ -39,13 +39,7 @@ #define DEFAULT_WIDTH MAX_ACCURACY_WIDTH -extern "C" { -KFloat Konan_FloatingPointParser_parseFloatImpl (KString s, KInt e); - -KFloat Konan_int_bits_to_float(KInt x); -} - -KFloat Konan_int_bits_to_float(KInt x) { +extern "C" KFloat Konan_int_bits_to_float(KInt x) { union { int32_t x; float f; @@ -73,6 +67,7 @@ static const U_32 tens[] = { }; #define tenToTheE(e) (*((KFloat *) (tens + (e)))) + #define LOG5_OF_TWO_TO_THE_N 11 #define sizeOfTenToTheE(e) (((e) / 19) + 1) @@ -124,9 +119,7 @@ static const U_32 tens[] = { #define allocateU64(x, n) if (!((x) = (U_64*) konan::calloc(1, (n) * sizeof(U_64)))) goto OutOfMemory; #define release(r) if ((r)) konan::free((r)); -KFloat -createFloat (const char *s, KInt e) -{ +KFloat createFloat(const char *s, KInt e) { /* assumes s is a null terminated string with at least one * character in it */ U_64 def[DEFAULT_WIDTH]; @@ -328,7 +321,7 @@ createFloat1 (U_64 * f, IDATA length, KInt e) if (e <= -309 || FLOAT_TO_INTBITS (result) == 0) FLOAT_TO_INTBITS (result) = MINIMUM_INTBITS; - return floatAlgorithm (f, length, e, (KFloat) result); + return floatAlgorithm (f, length, e, result); } #if defined(WIN32) @@ -544,27 +537,24 @@ OutOfMemory: #pragma optimize("",on) /*restore optimizations */ #endif -KFloat -Konan_FloatingPointParser_parseFloatImpl (KString s, KInt e) +extern "C" KFloat +Konan_FloatingPointParser_parseFloatImpl(KString s, KInt e) { const KChar* utf16 = CharArrayAddressOfElementAt(s, 0); KStdString utf8; utf8::unchecked::utf16to8(utf16, utf16 + s->count_, back_inserter(utf8)); const char *str = utf8.c_str(); - auto flt = createFloat (str, e); + auto flt = createFloat(str, e); - if (((I_32) FLOAT_TO_INTBITS (flt)) >= 0) - { - return flt; - } - else if (((I_32) FLOAT_TO_INTBITS (flt)) == (I_32) - 1) - { /* NumberFormatException */ - ThrowNumberFormatException(); - } - else - { /* OutOfMemoryError */ - ThrowOutOfMemoryError(); - } + if (((I_32) FLOAT_TO_INTBITS (flt)) >= 0) { + return flt; + } else if (((I_32) FLOAT_TO_INTBITS (flt)) == (I_32) - 1) { + /* NumberFormatException */ + ThrowNumberFormatException(); + } else { + /* OutOfMemoryError */ + ThrowOutOfMemoryError(); + } - return 0.0; + return 0.0f; }