[llvm] de1c287 - llvm/cmake/config.guess: add support for riscv32 and riscv64

Luís Marques via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 03:54:01 PST 2020


Author: Luís Marques
Date: 2020-02-14T11:53:51Z
New Revision: de1c2877a9ff12899ef50e179ade748fba8ab0c0

URL: https://github.com/llvm/llvm-project/commit/de1c2877a9ff12899ef50e179ade748fba8ab0c0
DIFF: https://github.com/llvm/llvm-project/commit/de1c2877a9ff12899ef50e179ade748fba8ab0c0.diff

LOG: 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

Added: 
    

Modified: 
    llvm/cmake/config.guess

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/config.guess b/llvm/cmake/config.guess
index ccb30f4e75e8..26d120601e49 100644
--- a/llvm/cmake/config.guess
+++ b/llvm/cmake/config.guess
@@ -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 ;;


        


More information about the llvm-commits mailing list