[llvm] e48a0df - [cmake] Add LoongArch to config.guess
Weining Lu via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 00:06:56 PDT 2022
Author: WANG Xuerui
Date: 2022-08-01T15:05:34+08:00
New Revision: e48a0df3fcfd2a58f957a86ae5f11a6bb5fa5d85
URL: https://github.com/llvm/llvm-project/commit/e48a0df3fcfd2a58f957a86ae5f11a6bb5fa5d85
DIFF: https://github.com/llvm/llvm-project/commit/e48a0df3fcfd2a58f957a86ae5f11a6bb5fa5d85.diff
LOG: [cmake] Add LoongArch to config.guess
Necessary for native builds on LoongArch. Only Linux is added for now,
matching upstream config.git changes.
Unfortunately, the upstream config.guess is GPLv3+ since 2012, and
LLVM is without autoconf support for a long time, so the script's
licensing exception no longer works and a bump could not be trivially
done.
This is the same as the [upstream commit adding LoongArch](https://git.savannah.gnu.org/gitweb/?p=config.git;a=commitdiff;h=c8ddc8472f8efcadafc1ef53ca1d863415fddd5f),
but rewritten to match the 2011 style that our script is holding on
to.
Differential Revision: https://reviews.llvm.org/D130820
Added:
Modified:
llvm/cmake/config.guess
Removed:
################################################################################
diff --git a/llvm/cmake/config.guess b/llvm/cmake/config.guess
index 60d3f588d6f7e..71abbf939f97f 100644
--- a/llvm/cmake/config.guess
+++ b/llvm/cmake/config.guess
@@ -922,6 +922,30 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
+ loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32: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 ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
More information about the llvm-commits
mailing list