SHA256
1
0
forked from pool/llvm
llvm/arm-suse-support.patch

75 lines
3.0 KiB
Diff

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