armv8l-unknown-linux-gnueabihf triplet from clang -dumpmachine on ARMv7l

Bug #1827175 reported by Jeffrey Walton on 2019-05-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
clang (Ubuntu)
Undecided
Unassigned

Bug Description

I'm working on a Tritium ARMv7 dev board (https://www.amazon.com/gp/product/B07D4L7GXZ). It has a Cortex-A7 (https://libre.computer/products/boards/all-h3-cc/).

I'm testing native build of a package using Clang.

GCC provides the following triplet:

    $ gcc -dumpmachine
    arm-linux-gnueabihf

Clang provides the following triplet:

    $ clang -dumpmachine
    armv8l-unknown-linux-gnueabihf

The Clang triplet is very unusual. I've never seen a compiler claim armv8l. ARM does not even have a hit for ARMv8l on their site (https://www.google.com/search?q="armv8l"+site%3Aarm.com). According to https://github.com/tsandmann/armv8l-toolchain-linux, it is an ARM A-53 toolchain. It looks like the mis-identification is causing some folks trouble, including me (https://stackoverflow.com/q/27121199/608639).

Perhaps it would be a good idea if Clang reported something closer to the board it is running on.

********************

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

$ apt-cache policy clang
clang:
  Installed: 1:6.0-41~exp5~ubuntu1
  Candidate: 1:6.0-41~exp5~ubuntu1
  Version table:
 *** 1:6.0-41~exp5~ubuntu1 500
        500 http://ports.ubuntu.com bionic-updates/universe armhf Packages
        100 /var/lib/dpkg/status
     1:6.0-41~exp4 500
        500 http://ports.ubuntu.com bionic/universe armhf Packages

Jeffrey Walton (noloader) wrote :

This may be helpful.

$ uname -a
Linux tritium 4.19.25-sunxi #5.78 SMP Mon Apr 8 07:46:22 CEST 2019 armv7l armv7l armv7l GNU/Linux

$ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

processor : 1
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

processor : 2
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

processor : 3
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

Hardware : Allwinner sun8i Family
Revision : 0000
Serial : 02c000421f791ea4
jwalton@tritium:~/cryptopp$

Sylvestre Ledru (sylvestre) wrote :

I don't have the bandwidth or the equipment to work on a fix but I will take a patch for this.
it should not be too hard, this part of the code is pretty easy to understand

On 01.05.19 07:21, Jeffrey Walton wrote:
> Public bug reported:
>
> I'm working on a Tritium ARMv7 dev board
> (https://www.amazon.com/gp/product/B07D4L7GXZ). It has a Cortex-A7
> (https://libre.computer/products/boards/all-h3-cc/).
>
> I'm testing native build of a package using Clang.
>
> GCC provides the following triplet:
>
> $ gcc -dumpmachine
> arm-linux-gnueabihf
>
> Clang provides the following triplet:
>
> $ clang -dumpmachine
> armv8l-unknown-linux-gnueabihf
>
> The Clang triplet is very unusual. I've never seen a compiler claim
> armv8l. ARM does not even have a hit for ARMv8l on their site
> (https://www.google.com/search?q="armv8l"+site%3Aarm.com). According to
> https://github.com/tsandmann/armv8l-toolchain-linux, it is an ARM A-53
> toolchain. It looks like the mis-identification is causing some folks
> trouble, including me (https://stackoverflow.com/q/27121199/608639).
>
> Perhaps it would be a good idea if Clang reported something closer to
> the board it is running on.

maybe it would help if clang would accept the -print-multiarch option.

Jeffrey Walton (noloader) wrote :

I tested a LePotato, which is an Aarch64 dev-board from the same maker (https://www.amazon.com/gp/product/B074N5B8KZ). Here are the results. They look OK:

    $ gcc -dumpmachine
    aarch64-linux-gnu

    $ clang -dumpmachine
    aarch64-unknown-linux-gnu

I also gave Autotools a spin with an updated config.sub. Autotools rewrites the triplet and provides an accurate machine:

    armv7l-unknown-linux-gnueabihf

The -dumpmachine option is very important. It is the option that tells us what we are building for. It may be different than the host architecture. Personally, I don't care about the host arch and cross-compiles. Everything is just a compile to me, and all GNUmake and Autoconf decisions are based on MACHINE in the triplet.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers