* Add automatic fixups for OSX/IOS cross-compilation * Add OSX/IOS cross-compilation test to Travis CI * Handle platforms that lack hwcap.h by falling back to ARMV8 * Fix PROLOGUE for OSX/IOStags/v0.3.8^2
| @@ -173,6 +173,14 @@ matrix: | |||||
| env: | env: | ||||
| - BTYPE="BINARY=32 FC=gfortran-8" | - BTYPE="BINARY=32 FC=gfortran-8" | ||||
| - <<: *test-macos | |||||
| osx_image: xcode10.1 | |||||
| env: | |||||
| - COMMON_FLAGS="NUM_THREADS=32" | |||||
| - CC="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode-10.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk" | |||||
| - CFLAGS="-O2 -isysroot /Applications/Xcode-10.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -arch arm64 -miphoneos-version-min=10.0" | |||||
| - BTYPE="TARGET=ARMV8 BINARY=64 HOSTCC=clang" | |||||
| # whitelist | # whitelist | ||||
| branches: | branches: | ||||
| only: | only: | ||||
| @@ -260,6 +260,19 @@ if ($architecture ne $hostarch) { | |||||
| $cross = 1 if ($os ne $hostos); | $cross = 1 if ($os ne $hostos); | ||||
| # rework cross suffix and architecture if we are on OSX cross-compiling for ARMV8-based IOS | |||||
| # the initial autodetection will have been confused by the command-line arguments to clang | |||||
| # and the cross-compiler apparently still claims to build for x86_64 in its CC -E output | |||||
| if (($os eq "Darwin") && ($cross_suffix ne "")) { | |||||
| my $tmpnam = `xcrun --sdk iphoneos --find clang`; | |||||
| $cross_suffix = substr($tmpnam, 0, rindex($tmpnam, "/")+1 ); | |||||
| # this should produce something like $cross_suffix="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"; | |||||
| $cross =1; | |||||
| $architecture = arm64; | |||||
| } | |||||
| $openmp = "" if $ENV{USE_OPENMP} != 1; | $openmp = "" if $ENV{USE_OPENMP} != 1; | ||||
| $linker_L = ""; | $linker_L = ""; | ||||
| @@ -107,7 +107,9 @@ static inline int blas_quickdivide(blasint x, blasint y){ | |||||
| .text ; | .text ; | ||||
| .p2align 2 ; | .p2align 2 ; | ||||
| .global REALNAME ; | .global REALNAME ; | ||||
| #ifndef __APPLE__ | |||||
| .type REALNAME, %function ; | .type REALNAME, %function ; | ||||
| #endif | |||||
| REALNAME: | REALNAME: | ||||
| .endm | .endm | ||||
| @@ -37,8 +37,10 @@ | |||||
| /*********************************************************************/ | /*********************************************************************/ | ||||
| #include "common.h" | #include "common.h" | ||||
| #if (defined OS_LINUX || defined OS_ANDROID) | |||||
| #include <asm/hwcap.h> | #include <asm/hwcap.h> | ||||
| #include <sys/auxv.h> | #include <sys/auxv.h> | ||||
| #endif | |||||
| extern gotoblas_t gotoblas_ARMV8; | extern gotoblas_t gotoblas_ARMV8; | ||||
| extern gotoblas_t gotoblas_CORTEXA57; | extern gotoblas_t gotoblas_CORTEXA57; | ||||
| @@ -105,13 +107,17 @@ static gotoblas_t *force_coretype(char *coretype) { | |||||
| static gotoblas_t *get_coretype(void) { | static gotoblas_t *get_coretype(void) { | ||||
| int implementer, variant, part, arch, revision, midr_el1; | int implementer, variant, part, arch, revision, midr_el1; | ||||
| #if (defined OS_LINUX || defined OS_ANDROID) | |||||
| if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) { | if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) { | ||||
| char coremsg[128]; | char coremsg[128]; | ||||
| snprintf(coremsg, 128, "Kernel lacks cpuid feature support. Auto detection of core type failed !!!\n"); | snprintf(coremsg, 128, "Kernel lacks cpuid feature support. Auto detection of core type failed !!!\n"); | ||||
| openblas_warning(1, coremsg); | openblas_warning(1, coremsg); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| #else | |||||
| return NULL; | |||||
| #endif | |||||
| get_cpu_ftr(MIDR_EL1, midr_el1); | get_cpu_ftr(MIDR_EL1, midr_el1); | ||||
| /* | /* | ||||