Skip to content

Commit de1c287

Browse files
committed
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
1 parent 2bef1c0 commit de1c287

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

llvm/cmake/config.guess

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,30 @@ EOF
973973
ppc:Linux:*:*)
974974
echo powerpc-unknown-linux-gnu
975975
exit ;;
976+
riscv32:Linux:*:* | riscv64:Linux:*:*)
977+
LIBC=gnu
978+
eval $set_cc_for_build
979+
# Do not check for __GLIBC__ because uclibc defines it too
980+
sed 's/^ //' << EOF >$dummy.c
981+
#include <features.h>
982+
#if defined(__UCLIBC__)
983+
LIBC=uclibc
984+
#elif defined(__dietlibc__)
985+
LIBC=dietlibc
986+
#endif
987+
EOF
988+
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
989+
990+
# There is no features test macro for musl
991+
# Follow the GNU's config.guess approach of
992+
# checking the output of ldd
993+
if command -v ldd >/dev/null && \
994+
ldd --version 2>&1 | grep -q ^musl; then
995+
LIBC=musl
996+
fi
997+
998+
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
999+
exit ;;
9761000
s390:Linux:*:* | s390x:Linux:*:*)
9771001
echo ${UNAME_MACHINE}-ibm-linux
9781002
exit ;;

0 commit comments

Comments
 (0)