From 8399a7a5170e28f35a82b14b764014a4bedbabf7 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Thu, 15 Nov 2018 09:52:20 -0700 Subject: [PATCH 1/2] i386 arch lacks registers to support some tfm assembly, detect and disable --- IDE/XCODE/README.md | 7 +++++++ IDE/XCODE/user_settings.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/IDE/XCODE/README.md b/IDE/XCODE/README.md index b2bfae757..6e065b1f1 100644 --- a/IDE/XCODE/README.md +++ b/IDE/XCODE/README.md @@ -54,6 +54,13 @@ device build. Both are debug builds. You can make an archive for a device, as well. That is a release build. +## Known issues: + +When building for older iPhone models that support the i386 architecture some +inline assembly in the fast math library assumes 64-bit registers and must be +disabled. This inline assembly can be disabled with `#define TFM_NO_ASM` when +using the setting `#define USE_FAST_MATH` on i386 targets. + # Installing libwolfssl.a Simply drag the file libwolfssl_XXX_.a and the directory `include` and drop it into diff --git a/IDE/XCODE/user_settings.h b/IDE/XCODE/user_settings.h index 132c9235d..5030b89ce 100644 --- a/IDE/XCODE/user_settings.h +++ b/IDE/XCODE/user_settings.h @@ -18,6 +18,9 @@ /* fast math */ #define USE_FAST_MATH + #ifdef __i386__ + #define TFM_NO_ASM + #endif #define HAVE_ECC /* ECC speedups */ From 6ed462f564b5ee21cc8c85a713b74e6d2bd7df63 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Tue, 27 Nov 2018 15:22:42 -0700 Subject: [PATCH 2/2] Provide example of appropriate CFLAGS for exposing registers on i386 required for inline assembly in tfm.c --- IDE/XCODE/README.md | 10 ++++++---- IDE/XCODE/build-for-i386.sh | 16 ++++++++++++++++ IDE/XCODE/user_settings.h | 3 --- 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100755 IDE/XCODE/build-for-i386.sh diff --git a/IDE/XCODE/README.md b/IDE/XCODE/README.md index 6e065b1f1..284e6069a 100644 --- a/IDE/XCODE/README.md +++ b/IDE/XCODE/README.md @@ -56,10 +56,12 @@ You can make an archive for a device, as well. That is a release build. ## Known issues: -When building for older iPhone models that support the i386 architecture some -inline assembly in the fast math library assumes 64-bit registers and must be -disabled. This inline assembly can be disabled with `#define TFM_NO_ASM` when -using the setting `#define USE_FAST_MATH` on i386 targets. +When building for older i386 architectures and using tfm.c there are specific +CFLAGS required to expose the necessary registers for inline assembly in tfm.c. +An example script has been provided "build-for-i386.sh" that targets the watchos +by default. If using SDK iphonesimulator10.1 or older you can change the SDK +variable in that script however newer versions of the SDK no longer support +i386 for the iphones. # Installing libwolfssl.a diff --git a/IDE/XCODE/build-for-i386.sh b/IDE/XCODE/build-for-i386.sh new file mode 100755 index 000000000..88507d2fe --- /dev/null +++ b/IDE/XCODE/build-for-i386.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +WORKSPACE=$(eval "pwd") +PROJ=wolfssl.xcodeproj +CONFIG=Release +SCHEME=wolfssl_ios +ARCH=i386 +SDK=watchsimulator5.1 +CONF_BUILD_DIR=${WORKSPACE}/simulator + +xcodebuild clean build -project ${PROJ} -configuration ${CONFIG} \ + -scheme ${SCHEME} -arch ${ARCH} -sdk ${SDK} \ + BITCODE_GENERATION_MODE=bitcode \ + OTHER_CFLAGS="-fembed-bitcode -O3 -fomit-frame-pointer" \ + CONFIGURATION_BUILD_DIR=${CONF_BUILD_DIR} \ + -quiet diff --git a/IDE/XCODE/user_settings.h b/IDE/XCODE/user_settings.h index 5030b89ce..132c9235d 100644 --- a/IDE/XCODE/user_settings.h +++ b/IDE/XCODE/user_settings.h @@ -18,9 +18,6 @@ /* fast math */ #define USE_FAST_MATH - #ifdef __i386__ - #define TFM_NO_ASM - #endif #define HAVE_ECC /* ECC speedups */