From 378ab7ce3d627cdb1b44ac61220079113df57192 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Wed, 8 Jul 2015 03:59:31 +0000 Subject: [PATCH] ARM: force on +vfp2 (ref #11817, ref #10602) this seems likely to be a better default for the majority of users. plus the failure mode is a SIGILL, rather than random data getting returned from floating point computations --- README.arm.md | 11 +++++++---- src/codegen.cpp | 16 +++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.arm.md b/README.arm.md index ea30b115f8784..97096189dbff0 100644 --- a/README.arm.md +++ b/README.arm.md @@ -57,10 +57,9 @@ If you run into issues building LLVM, see these notes: # Raspberry Pi -The Raspberry Pi ARM CPU is not correctly detected by LLVM. Before -starting the build, `export JULIA_CPU_ARCH=arm1176jzf-s`. This tells -LLVM that the CPU has VFP support. See the discussion in -[#10917](https://github.com/JuliaLang/julia/issues/10917). +The Raspberry Pi ARM CPU type is not detected by LLVM. +Before starting the build, it is recommented to add `export JULIA_CPU_ARCH=arm1176jzf-s` +to your Make.user file to tune the generated code for your CPU architecture. # Raspberry Pi 2 @@ -73,6 +72,10 @@ In the case of Raspberry Pi 2, download LLVM binaries from the LLVM website, sin override USE_SYSTEM_LLVM=1 ``` +# SIGILL during sysimg.o creation + +Its likely that your cpu does not support VFP. File an issue on the Julia issue tracker with the contents of /proc/cpuinfo. + # Chromebook diff --git a/src/codegen.cpp b/src/codegen.cpp index 5605542e9fcd3..1e833c6fb0c95 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5604,6 +5604,7 @@ extern "C" void jl_init_codegen(void) jl_mcjmm = new SectionMemoryManager(); #endif const char *mattr[] = { +#if defined(_CPU_X86_64_) || defined(_CPU_X86_) #ifndef USE_MCJIT // Temporarily disable Haswell BMI2 features due to LLVM bug. "-bmi2", "-avx2", @@ -5611,6 +5612,8 @@ extern "C" void jl_init_codegen(void) #ifdef V128_BUG "-avx", #endif +#endif + "", // padding to make sure this isn't an empty array (ref #11817) }; SmallVector MAttrs(mattr, mattr+sizeof(mattr)/sizeof(mattr[0])); #ifdef LLVM36 @@ -5640,14 +5643,17 @@ extern "C" void jl_init_codegen(void) TheTriple.setEnvironment(Triple::ELF); #endif #endif + StringRef TheCPU = strcmp(jl_options.cpu_target,"native") ? StringRef(jl_options.cpu_target) : StringRef(sys::getHostCPUName()); + if (TheCPU.empty() || TheCPU == StringRef("generic")) { + jl_printf(JL_STDERR, "warning: unable to determine host cpu name.\n"); +#ifdef _CPU_ARM_ + MAttrs.append(1, "+vfp2"); // the processors that don't have VFP are old and (hopefully) rare. this affects the platform calling convention. +#endif + } TargetMachine *targetMachine = eb.selectTarget( TheTriple, "", -#if LLVM35 - strcmp(jl_options.cpu_target,"native") ? StringRef(jl_options.cpu_target) : sys::getHostCPUName(), -#else - strcmp(jl_options.cpu_target,"native") ? jl_options.cpu_target : "", -#endif + TheCPU, MAttrs); jl_TargetMachine = targetMachine->getTarget().createTargetMachine( TheTriple.getTriple(),