From 789ac8b2768671ec83a7ed4a72c5fe27a1734c5e Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Wed, 29 May 2024 19:51:07 +0000 Subject: [PATCH] 8333189: Make sure clang on linux uses lld as linker Reviewed-by: jiangli, erikj --- make/autoconf/flags-ldflags.m4 | 2 +- make/data/hotspot-symbols/version-script-clang.txt | 8 ++++++++ .../{version-script.txt => version-script-gcc.txt} | 0 make/hotspot/lib/CompileJvm.gmk | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 make/data/hotspot-symbols/version-script-clang.txt rename make/data/hotspot-symbols/{version-script.txt => version-script-gcc.txt} (100%) diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index c4a75fb89c3..a2d0d4e606a 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -71,7 +71,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r" if test "x$OPENJDK_TARGET_OS" = xlinux; then - BASIC_LDFLAGS="-Wl,--exclude-libs,ALL" + BASIC_LDFLAGS="-fuse-ld=lld -Wl,--exclude-libs,ALL" 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/data/hotspot-symbols/version-script-clang.txt b/make/data/hotspot-symbols/version-script-clang.txt new file mode 100644 index 00000000000..351d64fdd1d --- /dev/null +++ b/make/data/hotspot-symbols/version-script-clang.txt @@ -0,0 +1,8 @@ +SUNWprivate_1.1 { + global: + *; + + local: + _fini; + _init; +}; diff --git a/make/data/hotspot-symbols/version-script.txt b/make/data/hotspot-symbols/version-script-gcc.txt similarity index 100% rename from make/data/hotspot-symbols/version-script.txt rename to make/data/hotspot-symbols/version-script-gcc.txt diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index ad374d57cee..dff7a159ae5 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -154,7 +154,7 @@ ifeq ($(call isTargetOs, windows), true) endif ifeq ($(call isTargetOs, linux), true) - HOTSPOT_VERSION_SCRIPT := $(TOPDIR)/make/data/hotspot-symbols/version-script.txt + HOTSPOT_VERSION_SCRIPT := $(TOPDIR)/make/data/hotspot-symbols/version-script-$(TOOLCHAIN_TYPE).txt JVM_LDFLAGS += -Wl,-version-script=$(HOTSPOT_VERSION_SCRIPT) endif