Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

ARM Triplet support is Debian-specific, Triplet support library is non-flexible #15557

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR15557
Status NEW
Importance P normal
Reported by Jon Masters (jonathan@jonmasters.org)
Reported on 2013-03-20 20:51:26 -0700
Last modified on 2019-05-24 15:52:44 -0700
Version trunk
Hardware Other Linux
CC anton@korobeynikov.info, awg@embtoolkit.org, compnerd@compnerd.org, jryans@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments gentoo-clang-hardfloat-fix.patch (573 bytes, text/plain)
Blocks PR15666
Blocked by
See also
[ Not filed against clang because this is a specific limitation in LLVM core ]

LLVM understands the traditional GNU concept of a Triplet (or Quadriplet):

 * arch-os-abi
 * arch-vendor-os-abi

For example "arm-linux-gnueabi". The LLVM Triplet implementation intends to
abstract this into a Triple class but unfortunately hard-codes various
assumptions about the way these are structured which do not cover all of the
deployed use cases. Worse, the current implementation specific to ARM makes
very distribution-specific assumptions that Debian (and its derivatives) are in
use.

Here is the triplet string encoding used for hardware-floating point enabled
versions of the ARM architecture based upon the newest "gnueabi":

 * arm-linux-gnueabihf

The above represents the Debian-specific triplet, whereas Fedora uses:

 * armv7hl-redhat-linux-gnueabi

Here, you can see that Debian treat hardware floating point as part of the ABI,
whereas Fedora treats the hardware floating point as part of the architecture.
There reasonable arguments for either approach, but unfortunately LLVM supports
only the former. This is because the precise position of various components of
the triplet is magic in the LLVM support library. Many code assumptions exist
such that it is not possible to easily separate out and abstract the difference.

I made a half-baked patch that added armv7hl-redhat-linux-gnueabi to the list
of ARMHFTriples in tools/clang/lib/Driver/ToolChains.cpp (along with some
detection code), but there are many other places that require fixing. I have
heard that there is an intention to rework the entire LLVM triplet code, so it
will be good to find out what the right course of action here is to De-
Debianify LLVM.
Quuxplusone commented 11 years ago
Confirmed! many valid GNU triplets are missing, not only for ARM but also
for MIPS for example.
The central repository for valid GNU triplets are here:
http://git.savannah.gnu.org/cgit/config.git
Quuxplusone commented 10 years ago

Attached gentoo-clang-hardfloat-fix.patch (573 bytes, text/plain): A tweak to fix the incorrect default ARM float ABI detection in Gentoo