llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.02k stars 11.96k forks source link

clang does not know Red Hat Linux ARM triplets armv7hl-redhat-linux and armv5tel-redhat-linux #16038

Open llvmbot opened 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 15666
Version 3.2
OS Linux
Depends On llvm/llvm-project#15929
Reporter LLVM Bugzilla Contributor

Extended Description

Clang on Fedora ARM does not work well because clang does not recognize the Fedora ARM triplets and fallback to software floating point, causing build failures like this:

clang: warning: unknown platform, assuming -mfloat-abi=soft
In file included from In file included from fsck_messages.c:25:
In file included from /usr/include/assert.hIn file included from :36cache.c:
:In file included from /usr/include/features.h24::
399In file included from :
/usr/include/errno.h:28/usr/include/gnu/stubs.h:
In file included from :/usr/include/features.h7::39911:
: fatal error: /usr/include/gnu/stubs.h'gnu/stubs-soft.h' file not found:
7:11: fatal error: 'gnu/stubs-soft.h' file not found
# include <gnu/stubs-soft.h># include <gnu/stubs-soft.h>
:

See this Fedora ARM bug: https://bugzilla.redhat.com/show_bug.cgi?id=803433

Earlier I tried a simple naive patch like:

--- llvm-3.2.src/tools/clang/lib/Driver/ToolChains.cpp~ 2012-12-17 00:59:27.000000000 +0900
+++ llvm-3.2.src/tools/clang/lib/Driver/ToolChains.cpp  2013-02-12 19:18:00.755164292 +0900
@@ -1054,10 +1054,12 @@
   static const char *const ARMLibDirs[] = { "/lib" };
   static const char *const ARMTriples[] = {
     "arm-linux-gnueabi",
-    "arm-linux-androideabi"
+    "arm-linux-androideabi",
+    "armv5tel-redhat-linux",
   };
   static const char *const ARMHFTriples[] = {
     "arm-linux-gnueabihf",
+    "armv7hl-redhat-linux",
   };

but it was not sufficient - maybe fixes are also needed to on the llvm side, perhaps?

(Similarly ppc64-redhat-linux is also not supported.)

widberg commented 10 months ago

Ten days after this issue was created, commit https://github.com/llvm/llvm-project/commit/50ba983d25c0885745bd0502ecc03e65f408440e added "armv7hl-redhat-linux-gnueabi" to ARMHFTriples as the issue suggests. The issue claims that ppc64-redhat-linux is not supported, but "ppc64-redhat-linux" was added to PPC64Triples by https://github.com/llvm/llvm-project/commit/4a4932c29bcd9b6638f6bebda9453703e9b69bd7, which was present in 3.2 which is the version of Clang the issue was opened with. It doesn't look like "armv5tel-redhat-linux" ever made it into ARMTriples as the issue suggests.

The issue https://github.com/llvm/llvm-project/issues/15929 mentions the armv7hl-redhat-linux-gnueabi triple. The author says that support is "half-baked" and claims to "have heard that there is an intention to rework the entire LLVM triplet code". If this is no longer a problem then these can both be closed. If this is still a problem, these issues are similar enough that they could potentially be consolidated.

Sorry for bumping this without a clear path forward, hopefully someone who knows more about this than I do can comment.

Endilll commented 10 months ago

@widberg Nice job doing the archeology and finding related issue! Can you also annotate code in descriptions with markdown? Old markup has been butchered during migration from bugzilla.

widberg commented 10 months ago

I have noticed the screwy code blocks. However, I cannot edit the issues as I am not a contributor.

MaskRay commented 10 months ago

Note: Variables like ARMTriples are now at Generic_GCC::GCCInstallationDetector::CollectLibDirsAndTriples(. I have a comment there that we should not hard code new target triples there.