From b94fc1bf83055a54798c088c846464b0f0bfc778 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 00:17:51 +0800 Subject: [PATCH 01/10] Move platform triplet detection code into Misc/platform_triplet.c --- Misc/platform_triplet.c | 179 ++++++++++++++++++++++++++++++++++++++ configure | 184 +--------------------------------------- configure.ac | 184 +--------------------------------------- 3 files changed, 183 insertions(+), 364 deletions(-) create mode 100644 Misc/platform_triplet.c diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c new file mode 100644 index 00000000000000..170af51dc7ee4c --- /dev/null +++ b/Misc/platform_triplet.c @@ -0,0 +1,179 @@ +/* Detect platform triplet from builtin defines + * cc -E Misc/platform_triplet.c | grep -v '^#' | grep -v '^ *$' | tr -d ' ' + */ +#undef bfin +#undef cris +#undef fr30 +#undef linux +#undef hppa +#undef hpux +#undef i386 +#undef mips +#undef powerpc +#undef sparc +#undef unix +#if defined(__ANDROID__) + # Android is not a multiarch system. +#elif defined(__linux__) +# if defined(__x86_64__) && defined(__LP64__) + x86_64-linux-gnu +# elif defined(__x86_64__) && defined(__ILP32__) + x86_64-linux-gnux32 +# elif defined(__i386__) + i386-linux-gnu +# elif defined(__aarch64__) && defined(__AARCH64EL__) +# if defined(__ILP32__) + aarch64_ilp32-linux-gnu +# else + aarch64-linux-gnu +# endif +# elif defined(__aarch64__) && defined(__AARCH64EB__) +# if defined(__ILP32__) + aarch64_be_ilp32-linux-gnu +# else + aarch64_be-linux-gnu +# endif +# elif defined(__alpha__) + alpha-linux-gnu +# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP) +# if defined(__ARMEL__) + arm-linux-gnueabihf +# else + armeb-linux-gnueabihf +# endif +# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP) +# if defined(__ARMEL__) + arm-linux-gnueabi +# else + armeb-linux-gnueabi +# endif +# elif defined(__hppa__) + hppa-linux-gnu +# elif defined(__ia64__) + ia64-linux-gnu +# elif defined(__loongarch__) +# if defined(__loongarch_lp64) +# if defined(__loongarch_soft_float) + loongarch64-linux-gnusf +# elif defined(__loongarch_single_float) + loongarch64-linux-gnuf32 +# elif defined(__loongarch_double_float) + loongarch64-linux-gnu +# else +# error unknown platform triplet +# endif +# else +# error unknown platform triplet +# endif +# elif defined(__m68k__) && !defined(__mcoldfire__) + m68k-linux-gnu +# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL) +# if _MIPS_SIM == _ABIO32 + mipsisa32r6el-linux-gnu +# elif _MIPS_SIM == _ABIN32 + mipsisa64r6el-linux-gnuabin32 +# elif _MIPS_SIM == _ABI64 + mipsisa64r6el-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) +# if _MIPS_SIM == _ABIO32 + mipsisa32r6-linux-gnu +# elif _MIPS_SIM == _ABIN32 + mipsisa64r6-linux-gnuabin32 +# elif _MIPS_SIM == _ABI64 + mipsisa64r6-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# elif defined(__mips_hard_float) && defined(_MIPSEL) +# if _MIPS_SIM == _ABIO32 + mipsel-linux-gnu +# elif _MIPS_SIM == _ABIN32 + mips64el-linux-gnuabin32 +# elif _MIPS_SIM == _ABI64 + mips64el-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# elif defined(__mips_hard_float) +# if _MIPS_SIM == _ABIO32 + mips-linux-gnu +# elif _MIPS_SIM == _ABIN32 + mips64-linux-gnuabin32 +# elif _MIPS_SIM == _ABI64 + mips64-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# elif defined(__or1k__) + or1k-linux-gnu +# elif defined(__powerpc__) && defined(__SPE__) + powerpc-linux-gnuspe +# elif defined(__powerpc64__) +# if defined(__LITTLE_ENDIAN__) + powerpc64le-linux-gnu +# else + powerpc64-linux-gnu +# endif +# elif defined(__powerpc__) + powerpc-linux-gnu +# elif defined(__s390x__) + s390x-linux-gnu +# elif defined(__s390__) + s390-linux-gnu +# elif defined(__sh__) && defined(__LITTLE_ENDIAN__) + sh4-linux-gnu +# elif defined(__sparc__) && defined(__arch64__) + sparc64-linux-gnu +# elif defined(__sparc__) + sparc-linux-gnu +# elif defined(__riscv) +# if __riscv_xlen == 32 + riscv32-linux-gnu +# elif __riscv_xlen == 64 + riscv64-linux-gnu +# else +# error unknown platform triplet +# endif +# else +# error unknown platform triplet +# endif +#elif defined(__FreeBSD_kernel__) +# if defined(__LP64__) + x86_64-kfreebsd-gnu +# elif defined(__i386__) + i386-kfreebsd-gnu +# else +# error unknown platform triplet +# endif +#elif defined(__gnu_hurd__) + i386-gnu +#elif defined(__APPLE__) + darwin +#elif defined(__VXWORKS__) + vxworks +#elif defined(__wasm32__) +# if defined(__EMSCRIPTEN__) + wasm32-emscripten +# elif defined(__wasi__) +# if defined(_REENTRANT) + wasm32-wasi-threads +# else + wasm32-wasi +# endif +# else +# error unknown wasm32 platform +# endif +#elif defined(__wasm64__) +# if defined(__EMSCRIPTEN__) + wasm64-emscripten +# elif defined(__wasi__) + wasm64-wasi +# else +# error unknown wasm64 platform +# endif +#else +# error unknown platform triplet +#endif diff --git a/configure b/configure index 18d404c8dc0605..192205f3b91315 100755 --- a/configure +++ b/configure @@ -6716,187 +6716,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5 printf %s "checking for the platform triplet based on compiler characteristics... " >&6; } -cat > conftest.c <=6) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsisa32r6el-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mipsisa64r6el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mipsisa64r6el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) -# if _MIPS_SIM == _ABIO32 - mipsisa32r6-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mipsisa64r6-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mipsisa64r6-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mips64el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mips64el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) -# if _MIPS_SIM == _ABIO32 - mips-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mips64-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mips64-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__or1k__) - or1k-linux-gnu -# elif defined(__powerpc__) && defined(__SPE__) - powerpc-linux-gnuspe -# elif defined(__powerpc64__) -# if defined(__LITTLE_ENDIAN__) - powerpc64le-linux-gnu -# else - powerpc64-linux-gnu -# endif -# elif defined(__powerpc__) - powerpc-linux-gnu -# elif defined(__s390x__) - s390x-linux-gnu -# elif defined(__s390__) - s390-linux-gnu -# elif defined(__sh__) && defined(__LITTLE_ENDIAN__) - sh4-linux-gnu -# elif defined(__sparc__) && defined(__arch64__) - sparc64-linux-gnu -# elif defined(__sparc__) - sparc-linux-gnu -# elif defined(__riscv) -# if __riscv_xlen == 32 - riscv32-linux-gnu -# elif __riscv_xlen == 64 - riscv64-linux-gnu -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif -#elif defined(__FreeBSD_kernel__) -# if defined(__LP64__) - x86_64-kfreebsd-gnu -# elif defined(__i386__) - i386-kfreebsd-gnu -# else -# error unknown platform triplet -# endif -#elif defined(__gnu_hurd__) - i386-gnu -#elif defined(__APPLE__) - darwin -#elif defined(__VXWORKS__) - vxworks -#elif defined(__wasm32__) -# if defined(__EMSCRIPTEN__) - wasm32-emscripten -# elif defined(__wasi__) -# if defined(_REENTRANT) - wasm32-wasi-threads -# else - wasm32-wasi -# endif -# else -# error unknown wasm32 platform -# endif -#elif defined(__wasm64__) -# if defined(__EMSCRIPTEN__) - wasm64-emscripten -# elif defined(__wasi__) - wasm64-wasi -# else -# error unknown wasm64 platform -# endif -#else -# error unknown platform triplet -#endif - -EOF - -if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then +if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` case "$build_os" in linux-musl*) @@ -6909,7 +6729,7 @@ else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 printf "%s\n" "none" >&6; } fi -rm -f conftest.c conftest.out +rm -f conftest.out { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for multiarch" >&5 printf %s "checking for multiarch... " >&6; } diff --git a/configure.ac b/configure.ac index cdb88a3071976c..37116e93a970fc 100644 --- a/configure.ac +++ b/configure.ac @@ -921,187 +921,7 @@ fi AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) -cat > conftest.c <=6) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsisa32r6el-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mipsisa64r6el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mipsisa64r6el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) -# if _MIPS_SIM == _ABIO32 - mipsisa32r6-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mipsisa64r6-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mipsisa64r6-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mips64el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mips64el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) -# if _MIPS_SIM == _ABIO32 - mips-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mips64-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mips64-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__or1k__) - or1k-linux-gnu -# elif defined(__powerpc__) && defined(__SPE__) - powerpc-linux-gnuspe -# elif defined(__powerpc64__) -# if defined(__LITTLE_ENDIAN__) - powerpc64le-linux-gnu -# else - powerpc64-linux-gnu -# endif -# elif defined(__powerpc__) - powerpc-linux-gnu -# elif defined(__s390x__) - s390x-linux-gnu -# elif defined(__s390__) - s390-linux-gnu -# elif defined(__sh__) && defined(__LITTLE_ENDIAN__) - sh4-linux-gnu -# elif defined(__sparc__) && defined(__arch64__) - sparc64-linux-gnu -# elif defined(__sparc__) - sparc-linux-gnu -# elif defined(__riscv) -# if __riscv_xlen == 32 - riscv32-linux-gnu -# elif __riscv_xlen == 64 - riscv64-linux-gnu -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif -#elif defined(__FreeBSD_kernel__) -# if defined(__LP64__) - x86_64-kfreebsd-gnu -# elif defined(__i386__) - i386-kfreebsd-gnu -# else -# error unknown platform triplet -# endif -#elif defined(__gnu_hurd__) - i386-gnu -#elif defined(__APPLE__) - darwin -#elif defined(__VXWORKS__) - vxworks -#elif defined(__wasm32__) -# if defined(__EMSCRIPTEN__) - wasm32-emscripten -# elif defined(__wasi__) -# if defined(_REENTRANT) - wasm32-wasi-threads -# else - wasm32-wasi -# endif -# else -# error unknown wasm32 platform -# endif -#elif defined(__wasm64__) -# if defined(__EMSCRIPTEN__) - wasm64-emscripten -# elif defined(__wasi__) - wasm64-wasi -# else -# error unknown wasm64 platform -# endif -#else -# error unknown platform triplet -#endif - -EOF - -if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then +if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` case "$build_os" in linux-musl*) @@ -1112,7 +932,7 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then else AC_MSG_RESULT([none]) fi -rm -f conftest.c conftest.out +rm -f conftest.out AC_MSG_CHECKING([for multiarch]) AS_CASE([$ac_sys_system], From 9419733c19b4910523023fcf5ab523dc5cd98bd0 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 00:58:14 +0800 Subject: [PATCH 02/10] Refactor MIPS detection, use defined(__mips64) to detect MIPS64 --- Misc/platform_triplet.c | 74 ++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 30 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 170af51dc7ee4c..bd8703ae9741b9 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -67,45 +67,59 @@ # endif # elif defined(__m68k__) && !defined(__mcoldfire__) m68k-linux-gnu -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsisa32r6el-linux-gnu -# elif _MIPS_SIM == _ABIN32 +# elif defined(__mips_hard_float) +# if defined(__mips_isa_rev) && (__mips_isa_rev >=6) +# if defined(_MIPSEL) && defined(__mips64) +# if _MIPS_SIM == _ABIO32 + mipsisa64r6el-linux-gnu +# elif _MIPS_SIM == _ABIN32 mipsisa64r6el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 +# elif _MIPS_SIM == _ABI64 mipsisa64r6el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) && defined(__mips_isa_rev) && (__mips_isa_rev >=6) -# if _MIPS_SIM == _ABIO32 - mipsisa32r6-linux-gnu -# elif _MIPS_SIM == _ABIN32 +# else +# error unknown platform triplet +# endif +# elif defined(_MIPSEL) + mipsisa32r6el-linux-gnu +# elif defined(__mips64) +# if _MIPS_SIM == _ABIO32 + mipsisa64r6-linux-gnu +# elif _MIPS_SIM == _ABIN32 mipsisa64r6-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 +# elif _MIPS_SIM == _ABI64 mipsisa64r6-linux-gnuabi64 +# else +# error unknown platform triplet +# endif +# else + mipsisa32r6-linux-gnu +# endif # else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-gnu -# elif _MIPS_SIM == _ABIN32 +# if defined(_MIPSEL) && defined(__mips64) +# if _MIPS_SIM == _ABIO32 + mips64el-linux-gnu +# elif _MIPS_SIM == _ABIN32 mips64el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 +# elif _MIPS_SIM == _ABI64 mips64el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif -# elif defined(__mips_hard_float) -# if _MIPS_SIM == _ABIO32 - mips-linux-gnu -# elif _MIPS_SIM == _ABIN32 +# else +# error unknown platform triplet +# endif +# elif defined(_MIPSEL) + mipsel-linux-gnu +# elif defined(__mips64) +# if _MIPS_SIM == _ABIO32 + mips64-linux-gnu +# elif _MIPS_SIM == _ABIN32 mips64-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 +# elif _MIPS_SIM == _ABI64 mips64-linux-gnuabi64 -# else -# error unknown platform triplet +# else +# error unknown platform triplet +# endif +# else + mips-linux-gnu +# endif # endif # elif defined(__or1k__) or1k-linux-gnu From c599e2b90732b05343c7590b79279724431b4197 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 01:49:36 +0800 Subject: [PATCH 03/10] Compute libc values in separate section --- Misc/platform_triplet.c | 165 +++++++++++++++++++--------------------- 1 file changed, 77 insertions(+), 88 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index bd8703ae9741b9..5122005a6df24e 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -15,145 +15,134 @@ #if defined(__ANDROID__) # Android is not a multiarch system. #elif defined(__linux__) +/* + * BEGIN of Linux block + */ +# define LIBC gnu +# define LIBC_X32 gnux32 +# if defined(__ARM_PCS_VFP) +# define LIBC_ARM gnueabihf +# else +# define LIBC_ARM gnueabi +# endif +# if defined(__loongarch__) +# if defined(__loongarch_soft_float) +# define LIBC_LA gnusf +# elif defined(__loongarch_single_float) +# define LIBC_LA gnuf32 +# elif defined(__loongarch_double_float) +# define LIBC_LA gnu +# else +# error unknown loongarch floating-point base abi +# endif +# endif +# if defined(_MIPS_SIM) +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS gnu +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS gnuabin32 +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS gnuabi64 +# else +# error unknown mips sim value +# endif +# endif +# if defined(__SPE__) +# define LIBC_PPC gnuspe +# else +# define LIBC_PPC gnu +# endif + # if defined(__x86_64__) && defined(__LP64__) - x86_64-linux-gnu + x86_64-linux-LIBC # elif defined(__x86_64__) && defined(__ILP32__) - x86_64-linux-gnux32 + x86_64-linux-LIBC_X32 # elif defined(__i386__) - i386-linux-gnu + i386-linux-LIBC # elif defined(__aarch64__) && defined(__AARCH64EL__) # if defined(__ILP32__) - aarch64_ilp32-linux-gnu + aarch64_ilp32-linux-LIBC # else - aarch64-linux-gnu + aarch64-linux-LIBC # endif # elif defined(__aarch64__) && defined(__AARCH64EB__) # if defined(__ILP32__) - aarch64_be_ilp32-linux-gnu + aarch64_be_ilp32-linux-LIBC # else - aarch64_be-linux-gnu + aarch64_be-linux-LIBC # endif # elif defined(__alpha__) - alpha-linux-gnu -# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP) + alpha-linux-LIBC +# elif defined(__ARM_EABI__) # if defined(__ARMEL__) - arm-linux-gnueabihf + arm-linux-LIBC_ARM # else - armeb-linux-gnueabihf -# endif -# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP) -# if defined(__ARMEL__) - arm-linux-gnueabi -# else - armeb-linux-gnueabi + armeb-linux-LIBC_ARM # endif # elif defined(__hppa__) - hppa-linux-gnu + hppa-linux-LIBC # elif defined(__ia64__) - ia64-linux-gnu -# elif defined(__loongarch__) -# if defined(__loongarch_lp64) -# if defined(__loongarch_soft_float) - loongarch64-linux-gnusf -# elif defined(__loongarch_single_float) - loongarch64-linux-gnuf32 -# elif defined(__loongarch_double_float) - loongarch64-linux-gnu -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif + ia64-linux-LIBC +# elif defined(__loongarch__) && defined(__loongarch_lp64) + loongarch64-linux-LIBC_LA # elif defined(__m68k__) && !defined(__mcoldfire__) - m68k-linux-gnu + m68k-linux-LIBC # elif defined(__mips_hard_float) # if defined(__mips_isa_rev) && (__mips_isa_rev >=6) # if defined(_MIPSEL) && defined(__mips64) -# if _MIPS_SIM == _ABIO32 - mipsisa64r6el-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mipsisa64r6el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mipsisa64r6el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif + mipsisa64r6el-linux-LIBC_MIPS # elif defined(_MIPSEL) - mipsisa32r6el-linux-gnu + mipsisa32r6el-linux-LIBC_MIPS # elif defined(__mips64) -# if _MIPS_SIM == _ABIO32 - mipsisa64r6-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mipsisa64r6-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mipsisa64r6-linux-gnuabi64 -# else -# error unknown platform triplet -# endif + mipsisa64r6-linux-LIBC_MIPS # else - mipsisa32r6-linux-gnu + mipsisa32r6-linux-LIBC_MIPS # endif # else # if defined(_MIPSEL) && defined(__mips64) -# if _MIPS_SIM == _ABIO32 - mips64el-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mips64el-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mips64el-linux-gnuabi64 -# else -# error unknown platform triplet -# endif + mips64el-linux-LIBC_MIPS # elif defined(_MIPSEL) - mipsel-linux-gnu + mipsel-linux-LIBC_MIPS # elif defined(__mips64) -# if _MIPS_SIM == _ABIO32 - mips64-linux-gnu -# elif _MIPS_SIM == _ABIN32 - mips64-linux-gnuabin32 -# elif _MIPS_SIM == _ABI64 - mips64-linux-gnuabi64 -# else -# error unknown platform triplet -# endif + mips64-linux-LIBC_MIPS # else - mips-linux-gnu + mips-linux-LIBC_MIPS # endif # endif # elif defined(__or1k__) - or1k-linux-gnu -# elif defined(__powerpc__) && defined(__SPE__) - powerpc-linux-gnuspe + or1k-linux-LIBC +# elif defined(__powerpc__) + powerpc-linux-LIBC_PPC # elif defined(__powerpc64__) # if defined(__LITTLE_ENDIAN__) - powerpc64le-linux-gnu + powerpc64le-linux-LIBC # else - powerpc64-linux-gnu + powerpc64-linux-LIBC # endif -# elif defined(__powerpc__) - powerpc-linux-gnu # elif defined(__s390x__) - s390x-linux-gnu + s390x-linux-LIBC # elif defined(__s390__) - s390-linux-gnu + s390-linux-LIBC # elif defined(__sh__) && defined(__LITTLE_ENDIAN__) - sh4-linux-gnu + sh4-linux-LIBC # elif defined(__sparc__) && defined(__arch64__) - sparc64-linux-gnu + sparc64-linux-LIBC # elif defined(__sparc__) - sparc-linux-gnu + sparc-linux-LIBC # elif defined(__riscv) # if __riscv_xlen == 32 - riscv32-linux-gnu + riscv32-linux-LIBC # elif __riscv_xlen == 64 - riscv64-linux-gnu + riscv64-linux-LIBC # else # error unknown platform triplet # endif # else # error unknown platform triplet # endif +/* + * END of Linux block + */ #elif defined(__FreeBSD_kernel__) # if defined(__LP64__) x86_64-kfreebsd-gnu From 2d82afc6de6bea11109fbf075e37daa0d0916b58 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 02:01:13 +0800 Subject: [PATCH 04/10] Add detection for MIPS soft float --- Misc/platform_triplet.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 5122005a6df24e..3d548272d38354 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -37,14 +37,26 @@ # endif # endif # if defined(_MIPS_SIM) -# if _MIPS_SIM == _ABIO32 -# define LIBC_MIPS gnu -# elif _MIPS_SIM == _ABIN32 -# define LIBC_MIPS gnuabin32 -# elif _MIPS_SIM == _ABI64 -# define LIBC_MIPS gnuabi64 +# if defined(__mips_hard_float) +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS gnu +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS gnuabin32 +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS gnuabi64 +# else +# error unknown mips sim value +# endif # else -# error unknown mips sim value +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS gnusf +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS gnuabin32sf +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS gnuabi64sf +# else +# error unknown mips sim value +# endif # endif # endif # if defined(__SPE__) @@ -87,7 +99,7 @@ loongarch64-linux-LIBC_LA # elif defined(__m68k__) && !defined(__mcoldfire__) m68k-linux-LIBC -# elif defined(__mips_hard_float) +# elif defined(__mips__) # if defined(__mips_isa_rev) && (__mips_isa_rev >=6) # if defined(_MIPSEL) && defined(__mips64) mipsisa64r6el-linux-LIBC_MIPS From 63d5ead244b78320931e39126e27eb5b8a2837b9 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 02:22:08 +0800 Subject: [PATCH 05/10] Add detection for musl musl supports SPE with its soft-float ABI: https://git.musl-libc.org/cgit/musl/commit/?id=7be59733d71ada3a32a98622507399253f1d5e48 --- Misc/platform_triplet.c | 139 +++++++++++++++++++++++++++++----------- configure | 7 +- configure.ac | 7 +- 3 files changed, 103 insertions(+), 50 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 3d548272d38354..4f705e6c524167 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -1,5 +1,5 @@ /* Detect platform triplet from builtin defines - * cc -E Misc/platform_triplet.c | grep -v '^#' | grep -v '^ *$' | tr -d ' ' + * cc -E Misc/platform_triplet.c | grep -v '^#' | grep -v '^ *$' | grep -v '^typedef' | tr -d ' ' */ #undef bfin #undef cris @@ -18,51 +18,114 @@ /* * BEGIN of Linux block */ -# define LIBC gnu -# define LIBC_X32 gnux32 -# if defined(__ARM_PCS_VFP) -# define LIBC_ARM gnueabihf -# else -# define LIBC_ARM gnueabi -# endif -# if defined(__loongarch__) -# if defined(__loongarch_soft_float) -# define LIBC_LA gnusf -# elif defined(__loongarch_single_float) -# define LIBC_LA gnuf32 -# elif defined(__loongarch_double_float) -# define LIBC_LA gnu +// Detect libc (based on config.guess) +# include +# if defined(__UCLIBC__) +# error uclibc not supported +# elif defined(__dietlibc__) +# error dietlibc not supported +# elif defined(__GLIBC__) +# define LIBC gnu +# define LIBC_X32 gnux32 +# if defined(__ARM_PCS_VFP) +# define LIBC_ARM gnueabihf # else -# error unknown loongarch floating-point base abi +# define LIBC_ARM gnueabi # endif -# endif -# if defined(_MIPS_SIM) -# if defined(__mips_hard_float) -# if _MIPS_SIM == _ABIO32 -# define LIBC_MIPS gnu -# elif _MIPS_SIM == _ABIN32 -# define LIBC_MIPS gnuabin32 -# elif _MIPS_SIM == _ABI64 -# define LIBC_MIPS gnuabi64 +# if defined(__loongarch__) +# if defined(__loongarch_soft_float) +# define LIBC_LA gnusf +# elif defined(__loongarch_single_float) +# define LIBC_LA gnuf32 +# elif defined(__loongarch_double_float) +# define LIBC_LA gnu # else -# error unknown mips sim value +# error unknown loongarch floating-point base abi # endif -# else -# if _MIPS_SIM == _ABIO32 -# define LIBC_MIPS gnusf -# elif _MIPS_SIM == _ABIN32 -# define LIBC_MIPS gnuabin32sf -# elif _MIPS_SIM == _ABI64 -# define LIBC_MIPS gnuabi64sf +# endif +# if defined(_MIPS_SIM) +# if defined(__mips_hard_float) +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS gnu +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS gnuabin32 +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS gnuabi64 +# else +# error unknown mips sim value +# endif # else -# error unknown mips sim value +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS gnusf +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS gnuabin32sf +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS gnuabi64sf +# else +# error unknown mips sim value +# endif # endif # endif -# endif -# if defined(__SPE__) -# define LIBC_PPC gnuspe +# if defined(__SPE__) +# define LIBC_PPC gnuspe +# else +# define LIBC_PPC gnu +# endif # else -# define LIBC_PPC gnu +/* Heuristic to detect musl libc + * Adds "typedef __builtin_va_list va_list;" to output + */ +# include +# ifdef __DEFINED_va_list +# define LIBC musl +# define LIBC_X32 muslx32 +# if defined(__ARM_PCS_VFP) +# define LIBC_ARM musleabihf +# else +# define LIBC_ARM musleabi +# endif +# if defined(__loongarch__) +# if defined(__loongarch_soft_float) +# define LIBC_LA muslsf +# elif defined(__loongarch_single_float) +# define LIBC_LA muslf32 +# elif defined(__loongarch_double_float) +# define LIBC_LA musl +# else +# error unknown loongarch floating-point base abi +# endif +# endif +# if defined(_MIPS_SIM) +# if defined(__mips_hard_float) +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS musl +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS musln32 +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS musl +# else +# error unknown mips sim value +# endif +# else +# if _MIPS_SIM == _ABIO32 +# define LIBC_MIPS muslsf +# elif _MIPS_SIM == _ABIN32 +# define LIBC_MIPS musln32sf +# elif _MIPS_SIM == _ABI64 +# define LIBC_MIPS muslsf +# else +# error unknown mips sim value +# endif +# endif +# endif +# if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) +# define LIBC_PPC muslsf +# else +# define LIBC_PPC musl +# endif +# else +# error unknown libc +# endif # endif # if defined(__x86_64__) && defined(__LP64__) diff --git a/configure b/configure index 192205f3b91315..51012668d3e4f1 100755 --- a/configure +++ b/configure @@ -6717,12 +6717,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5 printf %s "checking for the platform triplet based on compiler characteristics... " >&6; } if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` - case "$build_os" in - linux-musl*) - PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` - ;; - esac + PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | grep -v '^typedef' | tr -d ' '` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5 printf "%s\n" "$PLATFORM_TRIPLET" >&6; } else diff --git a/configure.ac b/configure.ac index 37116e93a970fc..ee833616db7d57 100644 --- a/configure.ac +++ b/configure.ac @@ -922,12 +922,7 @@ fi AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '` - case "$build_os" in - linux-musl*) - PLATFORM_TRIPLET=`echo "$PLATFORM_TRIPLET" | sed 's/linux-gnu/linux-musl/'` - ;; - esac + PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | grep -v '^typedef' | tr -d ' '` AC_MSG_RESULT([$PLATFORM_TRIPLET]) else AC_MSG_RESULT([none]) From b83ce541875b0a1ba31a1b936ab8bf1f4ce8bd35 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 02:37:32 +0800 Subject: [PATCH 06/10] Add NEWS --- .../next/Build/2023-07-25-02-30-00.gh-issue-95855.wA7rAf.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2023-07-25-02-30-00.gh-issue-95855.wA7rAf.rst diff --git a/Misc/NEWS.d/next/Build/2023-07-25-02-30-00.gh-issue-95855.wA7rAf.rst b/Misc/NEWS.d/next/Build/2023-07-25-02-30-00.gh-issue-95855.wA7rAf.rst new file mode 100644 index 00000000000000..fdc8b33f1de5dc --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-07-25-02-30-00.gh-issue-95855.wA7rAf.rst @@ -0,0 +1,2 @@ +Refactor platform triplet detection code and add detection for MIPS soft +float and musl libc. From 72e6b7e68ce305d7a1a2633ed16197e4d11a2333 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 25 Jul 2023 19:50:44 +0800 Subject: [PATCH 07/10] Fix whitespace --- Misc/platform_triplet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 4f705e6c524167..86cdb83e6a1a72 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -1,5 +1,5 @@ /* Detect platform triplet from builtin defines - * cc -E Misc/platform_triplet.c | grep -v '^#' | grep -v '^ *$' | grep -v '^typedef' | tr -d ' ' + * cc -E Misc/platform_triplet.c | grep -v '^#' | grep -v '^ *$' | grep -v '^typedef' | tr -d ' ' */ #undef bfin #undef cris @@ -234,21 +234,21 @@ vxworks #elif defined(__wasm32__) # if defined(__EMSCRIPTEN__) - wasm32-emscripten + wasm32-emscripten # elif defined(__wasi__) # if defined(_REENTRANT) - wasm32-wasi-threads + wasm32-wasi-threads # else - wasm32-wasi + wasm32-wasi # endif # else # error unknown wasm32 platform # endif #elif defined(__wasm64__) # if defined(__EMSCRIPTEN__) - wasm64-emscripten + wasm64-emscripten # elif defined(__wasi__) - wasm64-wasi + wasm64-wasi # else # error unknown wasm64 platform # endif From ee08d8e55531bcc8667ff20b335acba70bc7fec6 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 27 Jul 2023 20:00:35 +0800 Subject: [PATCH 08/10] Add `PLATFORM_TRIPLET=` prefix and grep for the prefix directly --- Misc/platform_triplet.c | 92 ++++++++++++++++++++--------------------- configure | 3 +- configure.ac | 3 +- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 86cdb83e6a1a72..7f70257a978d90 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -1,5 +1,5 @@ /* Detect platform triplet from builtin defines - * cc -E Misc/platform_triplet.c | grep -v '^#' | grep -v '^ *$' | grep -v '^typedef' | tr -d ' ' + * cc -E Misc/platform_triplet.c | grep '^PLATFORM_TRIPLET=' | tr -d ' ' */ #undef bfin #undef cris @@ -72,9 +72,7 @@ # define LIBC_PPC gnu # endif # else -/* Heuristic to detect musl libc - * Adds "typedef __builtin_va_list va_list;" to output - */ +// Heuristic to detect musl libc # include # ifdef __DEFINED_va_list # define LIBC musl @@ -129,86 +127,86 @@ # endif # if defined(__x86_64__) && defined(__LP64__) - x86_64-linux-LIBC +PLATFORM_TRIPLET=x86_64-linux-LIBC # elif defined(__x86_64__) && defined(__ILP32__) - x86_64-linux-LIBC_X32 +PLATFORM_TRIPLET=x86_64-linux-LIBC_X32 # elif defined(__i386__) - i386-linux-LIBC +PLATFORM_TRIPLET=i386-linux-LIBC # elif defined(__aarch64__) && defined(__AARCH64EL__) # if defined(__ILP32__) - aarch64_ilp32-linux-LIBC +PLATFORM_TRIPLET=aarch64_ilp32-linux-LIBC # else - aarch64-linux-LIBC +PLATFORM_TRIPLET=aarch64-linux-LIBC # endif # elif defined(__aarch64__) && defined(__AARCH64EB__) # if defined(__ILP32__) - aarch64_be_ilp32-linux-LIBC +PLATFORM_TRIPLET=aarch64_be_ilp32-linux-LIBC # else - aarch64_be-linux-LIBC +PLATFORM_TRIPLET=aarch64_be-linux-LIBC # endif # elif defined(__alpha__) - alpha-linux-LIBC +PLATFORM_TRIPLET=alpha-linux-LIBC # elif defined(__ARM_EABI__) # if defined(__ARMEL__) - arm-linux-LIBC_ARM +PLATFORM_TRIPLET=arm-linux-LIBC_ARM # else - armeb-linux-LIBC_ARM +PLATFORM_TRIPLET=armeb-linux-LIBC_ARM # endif # elif defined(__hppa__) - hppa-linux-LIBC +PLATFORM_TRIPLET=hppa-linux-LIBC # elif defined(__ia64__) - ia64-linux-LIBC +PLATFORM_TRIPLET=ia64-linux-LIBC # elif defined(__loongarch__) && defined(__loongarch_lp64) - loongarch64-linux-LIBC_LA +PLATFORM_TRIPLET=loongarch64-linux-LIBC_LA # elif defined(__m68k__) && !defined(__mcoldfire__) - m68k-linux-LIBC +PLATFORM_TRIPLET=m68k-linux-LIBC # elif defined(__mips__) # if defined(__mips_isa_rev) && (__mips_isa_rev >=6) # if defined(_MIPSEL) && defined(__mips64) - mipsisa64r6el-linux-LIBC_MIPS +PLATFORM_TRIPLET=mipsisa64r6el-linux-LIBC_MIPS # elif defined(_MIPSEL) - mipsisa32r6el-linux-LIBC_MIPS +PLATFORM_TRIPLET=mipsisa32r6el-linux-LIBC_MIPS # elif defined(__mips64) - mipsisa64r6-linux-LIBC_MIPS +PLATFORM_TRIPLET=mipsisa64r6-linux-LIBC_MIPS # else - mipsisa32r6-linux-LIBC_MIPS +PLATFORM_TRIPLET=mipsisa32r6-linux-LIBC_MIPS # endif # else # if defined(_MIPSEL) && defined(__mips64) - mips64el-linux-LIBC_MIPS +PLATFORM_TRIPLET=mips64el-linux-LIBC_MIPS # elif defined(_MIPSEL) - mipsel-linux-LIBC_MIPS +PLATFORM_TRIPLET=mipsel-linux-LIBC_MIPS # elif defined(__mips64) - mips64-linux-LIBC_MIPS +PLATFORM_TRIPLET=mips64-linux-LIBC_MIPS # else - mips-linux-LIBC_MIPS +PLATFORM_TRIPLET=mips-linux-LIBC_MIPS # endif # endif # elif defined(__or1k__) - or1k-linux-LIBC +PLATFORM_TRIPLET=or1k-linux-LIBC # elif defined(__powerpc__) - powerpc-linux-LIBC_PPC +PLATFORM_TRIPLET=powerpc-linux-LIBC_PPC # elif defined(__powerpc64__) # if defined(__LITTLE_ENDIAN__) - powerpc64le-linux-LIBC +PLATFORM_TRIPLET=powerpc64le-linux-LIBC # else - powerpc64-linux-LIBC +PLATFORM_TRIPLET=powerpc64-linux-LIBC # endif # elif defined(__s390x__) - s390x-linux-LIBC +PLATFORM_TRIPLET=s390x-linux-LIBC # elif defined(__s390__) - s390-linux-LIBC +PLATFORM_TRIPLET=s390-linux-LIBC # elif defined(__sh__) && defined(__LITTLE_ENDIAN__) - sh4-linux-LIBC +PLATFORM_TRIPLET=sh4-linux-LIBC # elif defined(__sparc__) && defined(__arch64__) - sparc64-linux-LIBC +PLATFORM_TRIPLET=sparc64-linux-LIBC # elif defined(__sparc__) - sparc-linux-LIBC +PLATFORM_TRIPLET=sparc-linux-LIBC # elif defined(__riscv) # if __riscv_xlen == 32 - riscv32-linux-LIBC +PLATFORM_TRIPLET=riscv32-linux-LIBC # elif __riscv_xlen == 64 - riscv64-linux-LIBC +PLATFORM_TRIPLET=riscv64-linux-LIBC # else # error unknown platform triplet # endif @@ -220,35 +218,35 @@ */ #elif defined(__FreeBSD_kernel__) # if defined(__LP64__) - x86_64-kfreebsd-gnu +PLATFORM_TRIPLET=x86_64-kfreebsd-gnu # elif defined(__i386__) - i386-kfreebsd-gnu +PLATFORM_TRIPLET=i386-kfreebsd-gnu # else # error unknown platform triplet # endif #elif defined(__gnu_hurd__) - i386-gnu +PLATFORM_TRIPLET=i386-gnu #elif defined(__APPLE__) - darwin +PLATFORM_TRIPLET=darwin #elif defined(__VXWORKS__) - vxworks +PLATFORM_TRIPLET=vxworks #elif defined(__wasm32__) # if defined(__EMSCRIPTEN__) - wasm32-emscripten +PLATFORM_TRIPLET=wasm32-emscripten # elif defined(__wasi__) # if defined(_REENTRANT) - wasm32-wasi-threads +PLATFORM_TRIPLET=wasm32-wasi-threads # else - wasm32-wasi +PLATFORM_TRIPLET=wasm32-wasi # endif # else # error unknown wasm32 platform # endif #elif defined(__wasm64__) # if defined(__EMSCRIPTEN__) - wasm64-emscripten +PLATFORM_TRIPLET=wasm64-emscripten # elif defined(__wasi__) - wasm64-wasi +PLATFORM_TRIPLET=wasm64-wasi # else # error unknown wasm64 platform # endif diff --git a/configure b/configure index 51012668d3e4f1..edd6fd0f0f1ce5 100755 --- a/configure +++ b/configure @@ -6717,7 +6717,8 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the platform triplet based on compiler characteristics" >&5 printf %s "checking for the platform triplet based on compiler characteristics... " >&6; } if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | grep -v '^typedef' | tr -d ' '` + PLATFORM_TRIPLET=`grep '^PLATFORM_TRIPLET=' conftest.out | tr -d ' '` + PLATFORM_TRIPLET="${PLATFORM_TRIPLET#PLATFORM_TRIPLET=}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PLATFORM_TRIPLET" >&5 printf "%s\n" "$PLATFORM_TRIPLET" >&6; } else diff --git a/configure.ac b/configure.ac index ee833616db7d57..f2194f7da2febf 100644 --- a/configure.ac +++ b/configure.ac @@ -922,7 +922,8 @@ fi AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then - PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | grep -v '^typedef' | tr -d ' '` + PLATFORM_TRIPLET=`grep '^PLATFORM_TRIPLET=' conftest.out | tr -d ' '` + PLATFORM_TRIPLET="${PLATFORM_TRIPLET#PLATFORM_TRIPLET=}" AC_MSG_RESULT([$PLATFORM_TRIPLET]) else AC_MSG_RESULT([none]) From 7fb142cf38a91fe2d811e39c841eec3802d8ac7d Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 27 Jul 2023 23:02:24 +0200 Subject: [PATCH 09/10] Use quadrigraph iso. literal # --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f2194f7da2febf..30f7e0c20a9758 100644 --- a/configure.ac +++ b/configure.ac @@ -923,7 +923,7 @@ fi AC_MSG_CHECKING([for the platform triplet based on compiler characteristics]) if $CPP $CPPFLAGS $srcdir/Misc/platform_triplet.c >conftest.out 2>/dev/null; then PLATFORM_TRIPLET=`grep '^PLATFORM_TRIPLET=' conftest.out | tr -d ' '` - PLATFORM_TRIPLET="${PLATFORM_TRIPLET#PLATFORM_TRIPLET=}" + PLATFORM_TRIPLET="${PLATFORM_TRIPLET@%:@PLATFORM_TRIPLET=}" AC_MSG_RESULT([$PLATFORM_TRIPLET]) else AC_MSG_RESULT([none]) From cbaf416f2e3560a026a0bccf6f9c914ea93f768d Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 9 Aug 2023 19:34:21 +0800 Subject: [PATCH 10/10] Fix powerpc64 detection --- Misc/platform_triplet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index 7f70257a978d90..c5e64b93553a7c 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -184,14 +184,14 @@ PLATFORM_TRIPLET=mips-linux-LIBC_MIPS # endif # elif defined(__or1k__) PLATFORM_TRIPLET=or1k-linux-LIBC -# elif defined(__powerpc__) -PLATFORM_TRIPLET=powerpc-linux-LIBC_PPC # elif defined(__powerpc64__) # if defined(__LITTLE_ENDIAN__) PLATFORM_TRIPLET=powerpc64le-linux-LIBC # else PLATFORM_TRIPLET=powerpc64-linux-LIBC # endif +# elif defined(__powerpc__) +PLATFORM_TRIPLET=powerpc-linux-LIBC_PPC # elif defined(__s390x__) PLATFORM_TRIPLET=s390x-linux-LIBC # elif defined(__s390__)