Accepting request 127989 from devel:tools:compiler

fix arm build, please forward to factory (forwarded request 127972 from adrianSuSE)

OBS-URL: https://build.opensuse.org/request/show/127989
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/llvm?expand=0&rev=30
This commit is contained in:
Stephan Kulow 2012-07-18 15:32:08 +00:00 committed by Git OBS Bridge
commit 0e98ef272d
3 changed files with 100 additions and 1 deletions

74
arm-suse-support.patch Normal file
View File

@ -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"
};

View File

@ -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 Fri Jul 13 21:03:40 UTC 2012 - llunak@suse.com

View File

@ -42,6 +42,7 @@ Patch6: rewrite-includes.patch
Patch7: pr12463.patch Patch7: pr12463.patch
Patch8: pr13141.patch Patch8: pr13141.patch
Patch9: pr13303.patch Patch9: pr13303.patch
Patch10: arm-suse-support.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
@ -144,6 +145,9 @@ touch tools/clang/test/Frontend/Inputs/rewrite-includes9.h
%patch7 -p0 %patch7 -p0
%patch8 -p0 %patch8 -p0
%patch9 -p1 %patch9 -p1
%ifarch %arm
%patch10
%endif
# We hardcode i586 # We hardcode i586
rm tools/clang/test/Driver/x86_features.c rm tools/clang/test/Driver/x86_features.c
@ -168,6 +172,12 @@ pushd stage1
--enable-optimized \ --enable-optimized \
--disable-assertions \ --disable-assertions \
--with-optimize-option="-O0" \ --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 --enable-targets=host
make %{?_smp_mflags} make %{?_smp_mflags}
@ -191,6 +201,13 @@ export CXX=$TOPLEVEL/stage1/Release/bin/clang++
--enable-targets=%{_supported_archs} \ --enable-targets=%{_supported_archs} \
%if 0%{?suse_version} >= 1220 %if 0%{?suse_version} >= 1220
--with-binutils-include=/usr/include \ --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 %endif
--with-clang-resource-dir="../%{_lib}/clang/%{_release_version}" --with-clang-resource-dir="../%{_lib}/clang/%{_release_version}"
@ -198,9 +215,12 @@ make %{?_smp_mflags} REQUIRES_RTTI=1
%check %check
cd stage2 cd stage2
%if 0%{!?qemu_user_space_build:1}
# we just do not have enough memory with qemu emulation
make check make check
cd tools/clang cd tools/clang
make test make test
%endif
%install %install
cd stage2 cd stage2