llvm/cmake/config.guess: add support for riscv32 and riscv64

Summary: LLVM configuration fails with 'unable to guess system type' on riscv64.
Add support for detecting riscv32 and riscv64 systems.

Patch by Gokturk Yuksek (gokturk)
Reviewers: erichkeane, rengolin, mgorny, aaron.ballman, beanz, luismarques
Reviewed By: luismarques
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68899
This commit is contained in:
Luís Marques 2020-02-14 11:49:18 +00:00
parent 2bef1c0e56
commit de1c2877a9
1 changed files with 24 additions and 0 deletions

View File

@ -973,6 +973,30 @@ EOF
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
# Do not check for __GLIBC__ because uclibc defines it too
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
# There is no features test macro for musl
# Follow the GNU's config.guess approach of
# checking the output of ldd
if command -v ldd >/dev/null && \
ldd --version 2>&1 | grep -q ^musl; then
LIBC=musl
fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;