[PATCH] D96402: [Driver] Recognize arm-none-linux-gnueabihf as valid ARMHF triple

Dmitry Antipov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 01:47:20 PST 2021


dmantipov created this revision.
dmantipov added a reviewer: clang.
Herald added subscribers: pengfei, kristof.beyls.
dmantipov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

After installing official 10.2-2020.11 AARCH64 / ARM toolchains from
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads,
under /home/user/.local, I've noticed that

clang -target aarch64-linux-gnu \

  -gcc-toolchain /home/user/.local/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu \
  --sysroot /home/user/.local/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu/aarch64-none-linux-gnu/libc \
  hello.c

works just as expected, but

clang -target arm-linux-gnueabihf \

  -gcc-toolchain /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf \
  --sysroot /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc \
  hello.c

is not:

clang -v -target arm-linux-gnueabihf -gcc-toolchain /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf --sysroot /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc t-hello.c 
clang version 13.0.0 (git at github.com:llvm/llvm-project.git 8caf835337f7bae9d686afdfc16c4897f2da61d8 <https://reviews.llvm.org/rG8caf835337f7bae9d686afdfc16c4897f2da61d8>)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /home/user/.local/llvm-13.0.0/bin
 "/home/user/.local/llvm-13.0.0/bin/clang-13" -cc1 -triple armv6kz-unknown-linux-gnueabihf -emit-obj -mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name t-hello.c -mrelocation-model static -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -target-cpu arm1176jzf-s -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi hard -fallow-half-arguments-and-returns -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /home/user/.local/llvm-13.0.0/lib64/clang/13.0.0 -isysroot /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc -internal-isystem /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/local/include -internal-isystem /home/user/.local/llvm-13.0.0/lib64/clang/13.0.0/include -internal-externc-isystem /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/include -internal-externc-isystem /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/include -fdebug-compilation-dir /home/user/tmp -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fcolor-diagnostics -faddrsig -o /tmp/t-hello-d957f6.o -x c t-hello.c
clang -cc1 version 13.0.0 based upon LLVM 13.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/local/include"
ignoring nonexistent directory "/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/user/.local/llvm-13.0.0/lib64/clang/13.0.0/include
 /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/include
End of search list.
 "/usr/bin/ld" --sysroot=/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc -EL -X --hash-style=gnu --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o a.out /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/lib/../lib/crt1.o /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/lib/../lib/crti.o crtbegin.o -L/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/lib/../lib -L/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/lib/../lib -L/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/lib -L/home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/lib /tmp/t-hello-d957f6.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/lib/../lib/crtn.o
/usr/bin/ld: fatal error: /home/user/.local/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc/usr/lib/../lib/crt1.o: unsupported ELF machine number 40
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)

This is because the driver recognizes 'aarch64-none-linux-gnu' as AARCH64 triple but
ignores 'arm-none-linux-gnueabihf' for ARM. So I think this should be fixed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96402

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2084,6 +2084,7 @@
   static const char *const ARMTriples[] = {"arm-linux-gnueabi",
                                            "arm-linux-androideabi"};
   static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+                                             "arm-none-linux-gnueabihf",
                                              "armv7hl-redhat-linux-gnueabi",
                                              "armv6hl-suse-linux-gnueabi",
                                              "armv7hl-suse-linux-gnueabi"};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96402.322619.patch
Type: text/x-patch
Size: 722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210210/4ff7c974/attachment-0001.bin>


More information about the cfe-commits mailing list