[PATCH] D68899: llvm/cmake/config.guess: add support for riscv32 and riscv64

Gokturk Yuksek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 17:01:01 PDT 2019


gokturk created this revision.
Herald added subscribers: llvm-commits, s.egerton, benna, psnobl, PkmX, rogfer01, shiva0217, kito-cheng, simoncook, mgorny.
Herald added a project: LLVM.
gokturk added reviewers: erichkeane, rengolin, mgorny.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68899

Files:
  llvm/cmake/config.guess


Index: llvm/cmake/config.guess
===================================================================
--- llvm/cmake/config.guess
+++ llvm/cmake/config.guess
@@ -973,6 +973,30 @@
     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 ;;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68899.224712.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191012/51481a71/attachment.bin>


More information about the llvm-commits mailing list