From 8c1cf8fabe810d4031c3d57e8b8f75f5c84a4974 Mon Sep 17 00:00:00 2001 From: Jiangli Zhou Date: Sat, 2 Nov 2024 01:11:20 +0000 Subject: [PATCH] 8339128: Cannot resolve user specified tool properly after JDK-8338304 Reviewed-by: erikj, ihse --- make/autoconf/flags-ldflags.m4 | 4 +++- make/autoconf/toolchain.m4 | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index 8183a0af7d0..bdbc898f987 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -73,7 +73,9 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], if test "x$OPENJDK_TARGET_OS" = xlinux; then # Clang needs the lld linker to work correctly BASIC_LDFLAGS="-fuse-ld=lld -Wl,--exclude-libs,ALL" - UTIL_REQUIRE_PROGS(LLD, lld) + if test "x$CXX_IS_USER_SUPPLIED" = xfalse && test "x$CC_IS_USER_SUPPLIED" = xfalse; then + UTIL_REQUIRE_PROGS(LLD, lld) + fi fi if test "x$OPENJDK_TARGET_OS" = xaix; then BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-bnolibpath -Wl,-bnoexpall \ diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index d84ae447e54..c240b9098bc 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -445,6 +445,7 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER], AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist]) fi fi + $1_IS_USER_SUPPLIED=true else # No user supplied value. Locate compiler ourselves. @@ -462,6 +463,7 @@ AC_DEFUN([TOOLCHAIN_FIND_COMPILER], HELP_MSG_MISSING_DEPENDENCY([devkit]) AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG]) fi + $1_IS_USER_SUPPLIED=false fi # Now we have a compiler binary in $1. Make sure it's okay.