Description: Fix defaults to use correct CPU and FPU on armhf Clang was defaulting to a rediculously low CPU on armhf, furthermore when The correct CPU is selected it defaults to incorrect FPU options for debian. This patch sets the defaults to appropriate values. Author: Peter Michael Green Bug-Debian: http://bugs.debian.org/704111 --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: , Bug: Bug-Debian: http://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: Reviewed-By: Last-Update: Index: llvm-toolchain-snapshot_3.4~svn183420/clang/lib/Driver/Tools.cpp =================================================================== --- llvm-toolchain-snapshot_3.4~svn183420.orig/clang/lib/Driver/Tools.cpp 2013-06-06 18:37:04.000000000 +0200 +++ llvm-toolchain-snapshot_3.4~svn183420/clang/lib/Driver/Tools.cpp 2013-06-06 18:37:15.000000000 +0200 @@ -490,6 +490,9 @@ if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) { // Otherwise, if we have -march= choose the base CPU for that arch. MArch = A->getValue(); + } else if (Triple.getEnvironment() == llvm::Triple::GNUEABIHF) { + // Use armv6 for armhf (raspbian version of patch) + MArch = "armv7-a"; } else { // Otherwise, use the Arch from the triple. MArch = Triple.getArchName(); @@ -783,8 +786,19 @@ } // Honor -mfpu=. - if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) + if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) { addFPUArgs(D, A, Args, CmdArgs); + } else { + if (StringRef(CPUName).startswith("cortex-a")) { + //Debian armhf uses vfpv3-d16 + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+vfp3"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("+d16"); + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); + } + } // Honor -mfpmath=. if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ))