From e3acbabf1de25228e3c4a36da0e987c1cbe91d5a Mon Sep 17 00:00:00 2001 From: MBaesken Date: Tue, 31 Mar 2026 17:03:09 +0200 Subject: [PATCH] JDK-8375177 --- make/autoconf/flags-cflags.m4 | 8 ++++---- test/hotspot/gtest/runtime/test_os_linux.cpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index ab9cd8be19bcb..4f673382bde7e 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -546,9 +546,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], # reduce lib size on linux in link step, this needs also special compile flags # do this on s390x also for libjvm (where serviceability agent is not supported) if test "x$ENABLE_LINKTIME_GC" = xtrue; then - TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections" + TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -DUSE_FUNCTION_SECTIONS -fdata-sections" if test "x$OPENJDK_TARGET_CPU" = xs390x && test "x$DEBUG_LEVEL" == xrelease; then - TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections" + TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -DUSE_FUNCTION_SECTIONS -fdata-sections" fi fi # technically NOT for CXX (but since this gives *worse* performance, use @@ -579,8 +579,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER], fi if test "x$ENABLE_LINKTIME_GC" = xtrue; then - TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections" - TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections" + TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -DUSE_FUNCTION_SECTIONS -fdata-sections" + TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -DUSE_FUNCTION_SECTIONS -fdata-sections" fi if test "x$OPENJDK_TARGET_OS" = xaix; then diff --git a/test/hotspot/gtest/runtime/test_os_linux.cpp b/test/hotspot/gtest/runtime/test_os_linux.cpp index 9c624267c1817..ea30b07e85caa 100644 --- a/test/hotspot/gtest/runtime/test_os_linux.cpp +++ b/test/hotspot/gtest/runtime/test_os_linux.cpp @@ -401,7 +401,9 @@ TEST_VM(os_linux, decoder_get_source_info_valid) { int line = -1; address valid_function_pointer = (address)ReportJNIFatalError; ASSERT_TRUE(Decoder::get_source_info(valid_function_pointer, buf, sizeof(buf), &line)); +#if !defined(USE_FUNCTION_SECTIONS) EXPECT_STREQ(buf, "jniCheck.hpp"); +#endif ASSERT_TRUE(line > 0); }