From: Martin Kroeker Date: Tue, 8 Oct 2019 18:13:14 +0000 (+0200) Subject: Simplify OSX/IOS cross-compilation and add a CI test for it (#2279) X-Git-Tag: upstream/0.3.21~30^2~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f6206fa2de4f533f003379588ca2a8b294e6c2f;p=platform%2Fupstream%2Fopenblas.git Simplify OSX/IOS cross-compilation and add a CI test for it (#2279) * 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/IOS --- diff --git a/.travis.yml b/.travis.yml index 72e2909..6016ec1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -173,6 +173,14 @@ matrix: env: - 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 branches: only: diff --git a/c_check b/c_check index 271182c..3d82aa7 100644 --- a/c_check +++ b/c_check @@ -260,6 +260,19 @@ if ($architecture ne $hostarch) { $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; $linker_L = ""; diff --git a/common_arm64.h b/common_arm64.h index c5e6948..f27ca8c 100644 --- a/common_arm64.h +++ b/common_arm64.h @@ -107,7 +107,9 @@ static inline int blas_quickdivide(blasint x, blasint y){ .text ; .p2align 2 ; .global REALNAME ; +#ifndef __APPLE__ .type REALNAME, %function ; +#endif REALNAME: .endm diff --git a/driver/others/dynamic_arm64.c b/driver/others/dynamic_arm64.c index b4ce6b6..9db9ba1 100644 --- a/driver/others/dynamic_arm64.c +++ b/driver/others/dynamic_arm64.c @@ -37,8 +37,10 @@ /*********************************************************************/ #include "common.h" +#if (defined OS_LINUX || defined OS_ANDROID) #include #include +#endif extern gotoblas_t gotoblas_ARMV8; extern gotoblas_t gotoblas_CORTEXA57; @@ -105,13 +107,17 @@ static gotoblas_t *force_coretype(char *coretype) { static gotoblas_t *get_coretype(void) { int implementer, variant, part, arch, revision, midr_el1; - + +#if (defined OS_LINUX || defined OS_ANDROID) if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) { char coremsg[128]; snprintf(coremsg, 128, "Kernel lacks cpuid feature support. Auto detection of core type failed !!!\n"); openblas_warning(1, coremsg); return NULL; } +#else + return NULL; +#endif get_cpu_ftr(MIDR_EL1, midr_el1); /*