From 010c7d4330bb46d07d9fedc2870e087e248bb3d80858d33d8131e37dd86781c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Mon, 16 Jul 2012 10:36:51 +0000 Subject: [PATCH] Accepting request 127972 from openSUSE:Factory:ARM fix arm build, please forward to factory OBS-URL: https://build.opensuse.org/request/show/127972 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm?expand=0&rev=157 --- arm-suse-support.patch | 74 ++++++++++++++++++++++++++++++++++++++++++ llvm.changes | 5 +++ llvm.spec | 22 ++++++++++++- 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 arm-suse-support.patch diff --git a/arm-suse-support.patch b/arm-suse-support.patch new file mode 100644 index 0000000..f89262f --- /dev/null +++ b/arm-suse-support.patch @@ -0,0 +1,74 @@ +Index: tools/clang/lib/Driver/Tools.cpp +=================================================================== +--- tools/clang/lib/Driver/Tools.cpp.orig ++++ tools/clang/lib/Driver/Tools.cpp +@@ -611,6 +611,11 @@ static StringRef getARMFloatABI(const Dr + } + + case llvm::Triple::Linux: { ++ StringRef ArchName = getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple)); ++ if (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || ArchName.startswith("v7")) { ++ FloatABI = "hard"; ++ break; ++ } else + if (Triple.getEnvironment() == llvm::Triple::GNUEABI) { + FloatABI = "softfp"; + break; +@@ -623,6 +627,9 @@ static StringRef getARMFloatABI(const Dr + case llvm::Triple::GNUEABI: + FloatABI = "softfp"; + break; ++ case llvm::Triple::GNUEABIHF: ++ FloatABI = "hard"; ++ break; + case llvm::Triple::EABI: + // EABI is always AAPCS, and if it was not marked 'hard', it's softfp + FloatABI = "softfp"; +@@ -665,6 +672,7 @@ void Clang::AddARMTargetArgs(const ArgLi + // Select the default based on the platform. + switch(Triple.getEnvironment()) { + case llvm::Triple::ANDROIDEABI: ++ case llvm::Triple::GNUEABIHF: + case llvm::Triple::GNUEABI: + ABIName = "aapcs-linux"; + break; +@@ -730,10 +738,11 @@ void Clang::AddARMTargetArgs(const ArgLi + + // Setting -msoft-float effectively disables NEON because of the GCC + // implementation, although the same isn't true of VFP or VFP3. +- if (FloatABI == "soft") { ++// if (FloatABI == "soft") { ++// we do not use neon on suse so far, disabling it always to avoid incompatible ABI + CmdArgs.push_back("-target-feature"); + CmdArgs.push_back("-neon"); +- } ++// } + + // Kernel code has more strict alignment requirements. + if (KernelOrKext) { +@@ -5062,8 +5071,9 @@ void linuxtools::Assemble::ConstructJob( + CmdArgs.push_back("-many"); + } else if (getToolChain().getArch() == llvm::Triple::arm) { + StringRef MArch = getToolChain().getArchName(); +- if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a") +- CmdArgs.push_back("-mfpu=neon"); ++// we do not use neon on suse so far, disabling it always to avoid incompatible ABI ++// if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a") ++// CmdArgs.push_back("-mfpu=neon"); + } else if (getToolChain().getArch() == llvm::Triple::mips || + getToolChain().getArch() == llvm::Triple::mipsel || + getToolChain().getArch() == llvm::Triple::mips64 || +Index: tools/clang/lib/Driver/ToolChains.cpp +=================================================================== +--- tools/clang/lib/Driver/ToolChains.cpp.orig ++++ tools/clang/lib/Driver/ToolChains.cpp +@@ -1185,6 +1185,9 @@ Generic_GCC::GCCInstallationDetector::GC + static const char *const ARMLibDirs[] = { "/lib" }; + static const char *const ARMTriples[] = { + "arm-linux-gnueabi", ++ "armv5el-suse-linux-gnueabi", ++ "armv7hl-suse-linux-gnueabi", ++ "armv7hl-suse-linux-gnueabihf", + "arm-linux-androideabi" + }; + diff --git a/llvm.changes b/llvm.changes index 3925430..0b635ea 100644 --- a/llvm.changes +++ b/llvm.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jul 14 17:30:58 UTC 2012 - adrian@suse.de + +- fix arm build + ------------------------------------------------------------------- Fri Jul 13 21:03:40 UTC 2012 - llunak@suse.com diff --git a/llvm.spec b/llvm.spec index 14420c4..ed19c2c 100644 --- a/llvm.spec +++ b/llvm.spec @@ -42,6 +42,7 @@ Patch6: rewrite-includes.patch Patch7: pr12463.patch Patch8: pr13141.patch Patch9: pr13303.patch +Patch10: arm-suse-support.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf BuildRequires: automake @@ -144,6 +145,9 @@ touch tools/clang/test/Frontend/Inputs/rewrite-includes9.h %patch7 -p0 %patch8 -p0 %patch9 -p1 +%ifarch %arm +%patch10 +%endif # We hardcode i586 rm tools/clang/test/Driver/x86_features.c @@ -168,6 +172,12 @@ pushd stage1 --enable-optimized \ --disable-assertions \ --with-optimize-option="-O0" \ +%ifarch %arm + --disable-sjlj-exceptions \ + --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-mode=thumb \ + --disable-werror --enable-checking=release \ + --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf \ +%endif --enable-targets=host make %{?_smp_mflags} @@ -188,9 +198,16 @@ export CXX=$TOPLEVEL/stage1/Release/bin/clang++ --disable-assertions \ --enable-pic \ --disable-timestamps \ - --enable-targets=%{_supported_archs} \ + --enable-targets=%{_supported_archs} \ %if 0%{?suse_version} >= 1220 --with-binutils-include=/usr/include \ +%endif +%ifarch %arm + --with-optimize-option="-U_GLIBCXX_ATOMIC_BUILTINS" \ + --disable-sjlj-exceptions \ + --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-mode=thumb \ + --disable-werror --enable-checking=release \ + --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf \ %endif --with-clang-resource-dir="../%{_lib}/clang/%{_release_version}" @@ -198,9 +215,12 @@ make %{?_smp_mflags} REQUIRES_RTTI=1 %check cd stage2 +%if 0%{!?qemu_user_space_build:1} +# we just do not have enough memory with qemu emulation make check cd tools/clang make test +%endif %install cd stage2