From 00130f8842e812c542901f640c0f72c85b1fcce5 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Fri, 9 Jan 2026 15:24:32 +0000 Subject: [PATCH 1/7] 8374899: [8u] Fully handle clang as the toolchain in flags.m4 --- common/autoconf/flags.m4 | 56 ++----- common/autoconf/generated-configure.sh | 201 +++++++++++-------------- 2 files changed, 105 insertions(+), 152 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index 8585f63123..f5c959e413 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -157,29 +157,13 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], # How to compile shared libraries. # - if test "x$TOOLCHAIN_TYPE" = xgcc; then - PICFLAG="-fPIC" - PIEFLAG="-fPIE" - C_FLAG_REORDER='' - CXX_FLAG_REORDER='' - - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # Linking is different on MacOSX - SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" - SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' - SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" - SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/[$]1' - SET_SHARED_LIBRARY_MAPFILE='' + if test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then + if test "x$TOOLCHAIN_TYPE" = xgcc; then + PICFLAG="-fPIC" + PIEFLAG="-fPIE" else - # Default works for linux, might work on other platforms as well. - SHARED_LIBRARY_FLAGS='-shared' - SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN[$]1' - SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN" - SET_SHARED_LIBRARY_NAME='-Xlinker -soname=[$]1' - SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=[$]1' + PICFLAG='' fi - elif test "x$TOOLCHAIN_TYPE" = xclang; then - PICFLAG='' C_FLAG_REORDER='' CXX_FLAG_REORDER='' @@ -366,21 +350,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION], else # The remaining toolchains share opt flags between CC and CXX; # setup for C and duplicate afterwards. - if test "x$TOOLCHAIN_TYPE" = xgcc; then - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # On MacOSX we optimize for size, something - # we should do for all platforms? - C_O_FLAG_HIGHEST="-Os" - C_O_FLAG_HI="-Os" - C_O_FLAG_NORM="-Os" - C_O_FLAG_NONE="" - else - C_O_FLAG_HIGHEST="-O3" - C_O_FLAG_HI="-O3" - C_O_FLAG_NORM="-O2" - C_O_FLAG_NONE="-O0" - fi - elif test "x$TOOLCHAIN_TYPE" = xclang; then + if test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then if test "x$OPENJDK_TARGET_OS" = xmacosx; then # On MacOSX we optimize for size, something # we should do for all platforms? @@ -433,7 +403,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall" CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt" CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt" - elif test "x$TOOLCHAIN_TYPE" = xgcc; then + elif test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then LEGACY_HOST_CFLAGS="$LEGACY_HOST_CFLAGS -fstack-protector" LEGACY_TARGET_CFLAGS="$LEGACY_TARGET_CFLAGS -fstack-protector" LEGACY_HOST_CXXFLAGS="$LEGACY_HOST_CXXFLAGS -fstack-protector" @@ -512,10 +482,10 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], FDLIBM_CFLAGS="" # Setup compiler/platform specific flags to CFLAGS_JDK, # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?) - if test "x$TOOLCHAIN_TYPE" = xgcc; then + if test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then # these options are used for both C and C++ compiles CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \ - -pipe -fstack-protector -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" + -pipe -fstack-protector" case $OPENJDK_TARGET_CPU_ARCH in arm ) # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing @@ -529,7 +499,11 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing" ;; esac - TOOLCHAIN_CHECK_COMPILER_VERSION(6, FLAGS_SETUP_GCC6_COMPILER_FLAGS) + + if test "x$TOOLCHAIN_TYPE" = xgcc; then + TOOLCHAIN_CHECK_COMPILER_VERSION(6, FLAGS_SETUP_GCC6_COMPILER_FLAGS) + fi + # Check that the compiler supports -Wformat-overflow flag # Set USE_FORMAT_OVERFLOW to 1 if it does. FLAGS_COMPILER_CHECK_ARGUMENTS([-Wformat-overflow -Werror], @@ -683,6 +657,8 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DPPC64" elif test "x$OPENJDK_TARGET_OS" = xbsd; then CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_ALLBSD_SOURCE" + elif test "x$OPENJDK_TARGET_OS" = xlinux; then + CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" fi # Additional macosx handling diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 2b16cf8710..27251b8e60 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -2561,7 +2561,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main (void) +main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; @@ -2578,7 +2578,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then : /* end confdefs.h. */ $4 int -main (void) +main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2605,7 +2605,7 @@ else /* end confdefs.h. */ $4 int -main (void) +main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; @@ -2622,7 +2622,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then : /* end confdefs.h. */ $4 int -main (void) +main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; @@ -2657,7 +2657,7 @@ while test "x$ac_lo" != "x$ac_hi"; do /* end confdefs.h. */ $4 int -main (void) +main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2682,12 +2682,12 @@ esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval (void) { return $2; } -static unsigned long int ulongval (void) { return $2; } +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } #include #include int -main (void) +main () { FILE *f = fopen ("conftest.val", "w"); @@ -2794,7 +2794,7 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (void); below. + which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -2812,7 +2812,7 @@ else #ifdef __cplusplus extern "C" #endif -char $2 (void); +char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ @@ -2821,7 +2821,7 @@ choke me #endif int -main (void) +main () { return $2 (); ; @@ -3710,7 +3710,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # -# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -3796,7 +3796,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - # # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -4411,7 +4410,7 @@ VS_TOOLSET_SUPPORTED_2022=true #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1716396031 +DATE_WHEN_GENERATED=1767977874 ############################################################################### # @@ -28905,7 +28904,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main (void) +main () { ; @@ -29045,7 +29044,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main (void) +main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -29109,7 +29108,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -29160,7 +29159,7 @@ else /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -29201,7 +29200,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -29216,7 +29215,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -29232,7 +29231,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -29281,7 +29280,9 @@ struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (char **p, int i) +static char *e (p, i) + char **p; + int i; { return p[i]; } @@ -29316,7 +29317,7 @@ int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, i int argc; char **argv; int -main (void) +main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; @@ -30649,7 +30650,7 @@ else /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -30690,7 +30691,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -30705,7 +30706,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -30721,7 +30722,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -33234,7 +33235,7 @@ else /* end confdefs.h. */ int -main (void) +main () { #ifndef __GNUC__ choke me @@ -33275,7 +33276,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -33290,7 +33291,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -33306,7 +33307,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -41852,7 +41853,7 @@ else #include int -main (void) +main () { ; @@ -41922,7 +41923,7 @@ else #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int -main (void) +main () { int i; for (i = 0; i < 256; i++) @@ -42220,7 +42221,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main (void) +main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ @@ -42240,7 +42241,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then : #include int -main (void) +main () { #if BYTE_ORDER != BIG_ENDIAN not big endian @@ -42266,7 +42267,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main (void) +main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros @@ -42283,7 +42284,7 @@ if ac_fn_cxx_try_compile "$LINENO"; then : #include int -main (void) +main () { #ifndef _BIG_ENDIAN not big endian @@ -42325,7 +42326,7 @@ short int ascii_mm[] = extern int foo; int -main (void) +main () { return use_ascii (foo) == use_ebcdic (foo); ; @@ -42351,7 +42352,7 @@ else /* end confdefs.h. */ $ac_includes_default int -main (void) +main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -42408,29 +42409,13 @@ $as_echo "$ac_cv_c_bigendian" >&6; } # How to compile shared libraries. # - if test "x$TOOLCHAIN_TYPE" = xgcc; then - PICFLAG="-fPIC" - PIEFLAG="-fPIE" - C_FLAG_REORDER='' - CXX_FLAG_REORDER='' - - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # Linking is different on MacOSX - SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" - SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker @loader_path/.' - SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" - SET_SHARED_LIBRARY_NAME='-Xlinker -install_name -Xlinker @rpath/$1' - SET_SHARED_LIBRARY_MAPFILE='' + if test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then + if test "x$TOOLCHAIN_TYPE" = xgcc; then + PICFLAG="-fPIC" + PIEFLAG="-fPIE" else - # Default works for linux, might work on other platforms as well. - SHARED_LIBRARY_FLAGS='-shared' - SET_EXECUTABLE_ORIGIN='-Xlinker -rpath -Xlinker \$$$$ORIGIN$1' - SET_SHARED_LIBRARY_ORIGIN="-Xlinker -z -Xlinker origin $SET_EXECUTABLE_ORIGIN" - SET_SHARED_LIBRARY_NAME='-Xlinker -soname=$1' - SET_SHARED_LIBRARY_MAPFILE='-Xlinker -version-script=$1' + PICFLAG='' fi - elif test "x$TOOLCHAIN_TYPE" = xclang; then - PICFLAG='' C_FLAG_REORDER='' CXX_FLAG_REORDER='' @@ -42584,21 +42569,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; } else # The remaining toolchains share opt flags between CC and CXX; # setup for C and duplicate afterwards. - if test "x$TOOLCHAIN_TYPE" = xgcc; then - if test "x$OPENJDK_TARGET_OS" = xmacosx; then - # On MacOSX we optimize for size, something - # we should do for all platforms? - C_O_FLAG_HIGHEST="-Os" - C_O_FLAG_HI="-Os" - C_O_FLAG_NORM="-Os" - C_O_FLAG_NONE="" - else - C_O_FLAG_HIGHEST="-O3" - C_O_FLAG_HI="-O3" - C_O_FLAG_NORM="-O2" - C_O_FLAG_NONE="-O0" - fi - elif test "x$TOOLCHAIN_TYPE" = xclang; then + if test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then if test "x$OPENJDK_TARGET_OS" = xmacosx; then # On MacOSX we optimize for size, something # we should do for all platforms? @@ -42649,7 +42620,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; } LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall" CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt" CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt" - elif test "x$TOOLCHAIN_TYPE" = xgcc; then + elif test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then LEGACY_HOST_CFLAGS="$LEGACY_HOST_CFLAGS -fstack-protector" LEGACY_TARGET_CFLAGS="$LEGACY_TARGET_CFLAGS -fstack-protector" LEGACY_HOST_CXXFLAGS="$LEGACY_HOST_CXXFLAGS -fstack-protector" @@ -42785,10 +42756,10 @@ fi FDLIBM_CFLAGS="" # Setup compiler/platform specific flags to CFLAGS_JDK, # CXXFLAGS_JDK and CCXXFLAGS_JDK (common to C and CXX?) - if test "x$TOOLCHAIN_TYPE" = xgcc; then + if test "x$TOOLCHAIN_TYPE" = xgcc -o "x$TOOLCHAIN_TYPE" = xclang; then # these options are used for both C and C++ compiles CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Wall -Wno-parentheses -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2 \ - -pipe -fstack-protector -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" + -pipe -fstack-protector" case $OPENJDK_TARGET_CPU_ARCH in arm ) # on arm we don't prevent gcc to omit frame pointer but do prevent strict aliasing @@ -42803,6 +42774,8 @@ fi ;; esac + if test "x$TOOLCHAIN_TYPE" = xgcc; then + REFERENCE_VERSION=6 if [[ "$REFERENCE_VERSION" =~ (.*\.){3} ]] ; then @@ -43020,6 +42993,8 @@ $as_echo "$supports" >&6; } : fi + fi + # Check that the compiler supports -Wformat-overflow flag # Set USE_FORMAT_OVERFLOW to 1 if it does. @@ -43375,6 +43350,8 @@ $as_echo "$supports" >&6; } CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DPPC64" elif test "x$OPENJDK_TARGET_OS" = xbsd; then CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_ALLBSD_SOURCE" + elif test "x$OPENJDK_TARGET_OS" = xlinux; then + CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE" fi # Additional macosx handling @@ -44173,7 +44150,7 @@ if test "$ac_x_libraries" = no; then /* end confdefs.h. */ #include int -main (void) +main () { XrmInitialize () ; @@ -44259,7 +44236,7 @@ $as_echo_n "checking whether -R must be followed by a space... " >&6; } /* end confdefs.h. */ int -main (void) +main () { ; @@ -44276,7 +44253,7 @@ else /* end confdefs.h. */ int -main (void) +main () { ; @@ -44320,9 +44297,9 @@ rm -f core conftest.err conftest.$ac_objext \ #ifdef __cplusplus extern "C" #endif -char XOpenDisplay (void); +char XOpenDisplay (); int -main (void) +main () { return XOpenDisplay (); ; @@ -44348,9 +44325,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dnet_ntoa (void); +char dnet_ntoa (); int -main (void) +main () { return dnet_ntoa (); ; @@ -44389,9 +44366,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dnet_ntoa (void); +char dnet_ntoa (); int -main (void) +main () { return dnet_ntoa (); ; @@ -44449,9 +44426,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gethostbyname (void); +char gethostbyname (); int -main (void) +main () { return gethostbyname (); ; @@ -44490,9 +44467,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gethostbyname (void); +char gethostbyname (); int -main (void) +main () { return gethostbyname (); ; @@ -44546,9 +44523,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char connect (void); +char connect (); int -main (void) +main () { return connect (); ; @@ -44595,9 +44572,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char remove (void); +char remove (); int -main (void) +main () { return remove (); ; @@ -44644,9 +44621,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char shmat (void); +char shmat (); int -main (void) +main () { return shmat (); ; @@ -44696,9 +44673,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char IceConnectionNumber (void); +char IceConnectionNumber (); int -main (void) +main () { return IceConnectionNumber (); ; @@ -46282,7 +46259,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext int -main (void) +main () { return main (); ; @@ -46372,9 +46349,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char DGifGetCode (void); +char DGifGetCode (); int -main (void) +main () { return DGifGetCode (); ; @@ -46438,9 +46415,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char compress (void); +char compress (); int -main (void) +main () { return compress (); ; @@ -46524,7 +46501,7 @@ $as_echo "system not found" >&6; } /* end confdefs.h. */ #include int -main (void) +main () { return (int)altzone; ; @@ -46565,9 +46542,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char cos (void); +char cos (); int -main (void) +main () { return cos (); ; @@ -46624,9 +46601,9 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dlopen (void); +char dlopen (); int -main (void) +main () { return dlopen (); ; @@ -46694,7 +46671,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu /* end confdefs.h. */ int -main (void) +main () { return 0; ; @@ -46736,7 +46713,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu /* end confdefs.h. */ int -main (void) +main () { return 0; ; @@ -52527,7 +52504,7 @@ $as_echo_n "checking if C-compiler supports ccache precompiled headers... " >&6; /* end confdefs.h. */ int -main (void) +main () { ; From 20b3a197304b2ed0d14b7bf4312c0890c53d16b2 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Fri, 9 Jan 2026 15:25:35 +0000 Subject: [PATCH 2/7] Whitespace cleanup --- common/autoconf/flags.m4 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index f5c959e413..5d1ef8732f 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -124,7 +124,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS], if test "x$TOOLCHAIN_TYPE" = xsolstudio; then if test "x$OPENJDK_TARGET_OS" = xsolaris; then # Solaris Studio does not have a concept of sysroot. Instead we must - # make sure the default include and lib dirs are appended to each + # make sure the default include and lib dirs are appended to each # compile and link command line. SYSROOT_CFLAGS="-I$SYSROOT/usr/include" SYSROOT_LDFLAGS="-L$SYSROOT/usr/lib$OPENJDK_TARGET_CPU_ISADIR \ @@ -546,7 +546,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DcpuIntel -Di586 -D$OPENJDK_TARGET_CPU_LEGACY_LIB" CFLAGS_JDK="$CFLAGS_JDK -erroff=E_BAD_PRAGMA_PACK_VALUE" fi - + CFLAGS_JDK="$CFLAGS_JDK -xc99=%none -xCC -errshort=tags -Xa -v -mt -W0,-noglobal" CXXFLAGS_JDK="$CXXFLAGS_JDK -errtags=yes +w -mt -features=no%except -DCC_NOEX -norunpath -xnolib" elif test "x$TOOLCHAIN_TYPE" = xxlc; then @@ -627,14 +627,14 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], if test "x$OPENJDK_TARGET_CPU" = xppc64le; then CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DABI_ELFv2" fi - + # Setup target OS define. Use OS target name but in upper case. OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D$OPENJDK_TARGET_OS_UPPERCASE" # Setup target CPU CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DARCH='\"$OPENJDK_TARGET_CPU_LEGACY\"' -D$OPENJDK_TARGET_CPU_LEGACY" - + # Setup debug/release defines if test "x$DEBUG_LEVEL" = xrelease; then CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG" @@ -669,7 +669,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], # The expected format is X.Y.Z MACOSX_VERSION_MIN=11.00.00 AC_SUBST(MACOSX_VERSION_MIN) - + # The macro takes the version with no dots, ex: 1070 # Let the flags variables get resolved in make for easier override on make # command line. @@ -803,7 +803,7 @@ AC_DEFUN([FLAGS_C_COMPILER_CHECK_ARGUMENTS], saved_cflags="$CFLAGS" CFLAGS="$CFLAGS $1" AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], [supports=no]) AC_LANG_POP([C]) CFLAGS="$saved_cflags" @@ -828,11 +828,11 @@ AC_DEFUN([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS], saved_cxxflags="$CXXFLAGS" CXXFLAGS="$CXXFLAG $1" AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [], [supports=no]) AC_LANG_POP([C++]) CXXFLAGS="$saved_cxxflags" - + AC_MSG_RESULT([$supports]) if test "x$supports" = "xyes" ; then m4_ifval([$2], [$2], [:]) @@ -857,7 +857,7 @@ AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS], AC_MSG_CHECKING([if both compilers support "$1"]) supports=no if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then supports=yes; fi - + AC_MSG_RESULT([$supports]) if test "x$supports" = "xyes" ; then m4_ifval([$2], [$2], [:]) @@ -904,4 +904,3 @@ AC_DEFUN_ONCE([FLAGS_SETUP_GCC6_COMPILER_FLAGS], CFLAGS_JDK="${CFLAGS_JDK} ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}" AC_SUBST([NO_LIFETIME_DSE_CFLAG]) ]) - From a58971d6c8b1b385529d905fbaca6521938e2f71 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Fri, 9 Jan 2026 15:42:41 +0000 Subject: [PATCH 3/7] Add LOG_LEVEL=debug to all GHA builds --- .github/workflows/submit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index 77d80badfc..fd99860b86 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -534,7 +534,7 @@ jobs: working-directory: jdk - name: Build - run: make CONF_NAME=linux-x86 images + run: make CONF_NAME=linux-x86 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts @@ -818,7 +818,7 @@ jobs: run: | $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; - & make CONF_NAME=windows-x64 FORCE_MSC_VER=1912 FORCE_LD_VER=1412 images + & make CONF_NAME=windows-x64 FORCE_MSC_VER=1912 FORCE_LD_VER=1412 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts @@ -1001,7 +1001,7 @@ jobs: run: | $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; - & make CONF_NAME=windows-x86 images + & make CONF_NAME=windows-x86 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts @@ -1426,7 +1426,7 @@ jobs: working-directory: jdk - name: Build - run: make CONF_NAME=macos-x64 images + run: make CONF_NAME=macos-x64 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts From f82b5ef146431ed8068b5d1e90a290a75c74cbc6 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Sat, 10 Jan 2026 00:58:05 +0000 Subject: [PATCH 4/7] Print spec files on all POSIX platforms --- .github/workflows/submit.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index fd99860b86..fff3b7a8fa 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -175,7 +175,10 @@ jobs: working-directory: jdk - name: Build - run: make CONF_NAME=linux-x64 LOG_LEVEL=debug images + run: | + cat build/linux-x64/spec.gmk + cat build/linux-x64/hotspot-spec.gmk + make CONF_NAME=linux-x64 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts @@ -534,7 +537,10 @@ jobs: working-directory: jdk - name: Build - run: make CONF_NAME=linux-x86 LOG_LEVEL=debug images + run: | + cat build/linux-x86/spec.gmk + cat build/linux-x86/hotspot-spec.gmk + make CONF_NAME=linux-x86 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts @@ -1426,7 +1432,10 @@ jobs: working-directory: jdk - name: Build - run: make CONF_NAME=macos-x64 LOG_LEVEL=debug images + run: | + cat build/macos-x64/spec.gmk + cat build/macos-x64/hotspot-spec.gmk + make CONF_NAME=macos-x64 LOG_LEVEL=debug images working-directory: jdk - name: Pack artifacts From 7c14dd33fcac51c3b10130222a3de10210a85d17 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Thu, 8 Jan 2026 01:01:29 +0000 Subject: [PATCH 5/7] Backport 1b0f612e5e08cfa1581cf22433b36b5f075c0f23 --- .github/workflows/submit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml index fff3b7a8fa..0675530fbc 100644 --- a/.github/workflows/submit.yml +++ b/.github/workflows/submit.yml @@ -1350,7 +1350,7 @@ jobs: macos_x64_build: name: macOS x64 - runs-on: "macos-13" + runs-on: "macos-15-intel" needs: prerequisites if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_macos_x64 != 'false' @@ -1417,7 +1417,7 @@ jobs: run: brew install make gawk - name: Select Xcode version - run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer + run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer - name: Configure run: > @@ -1451,7 +1451,7 @@ jobs: macos_x64_test: name: macOS x64 - runs-on: "macos-13" + runs-on: "macos-15-intel" needs: - prerequisites - macos_x64_build @@ -1540,7 +1540,7 @@ jobs: run: brew install make gawk - name: Select Xcode version - run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer + run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer - name: Run tests run: > From 4e5afd45312369f3f7786a631cd9d6c3b5dca67f Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Sat, 10 Jan 2026 12:57:03 +0000 Subject: [PATCH 6/7] 8374948: [8u] saproc & jsig builds add duplicate linker flags on Darwin/MacOS --- hotspot/make/bsd/makefiles/gcc.make | 5 +++-- hotspot/make/bsd/makefiles/jsig.make | 4 ++-- hotspot/make/bsd/makefiles/saproc.make | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hotspot/make/bsd/makefiles/gcc.make b/hotspot/make/bsd/makefiles/gcc.make index 0e2ca9b3b8..7c84ce26de 100644 --- a/hotspot/make/bsd/makefiles/gcc.make +++ b/hotspot/make/bsd/makefiles/gcc.make @@ -346,9 +346,10 @@ ifeq ($(OS_VENDOR), Darwin) MACOSX_VERSION_MIN=11.00.00 endif # The macro takes the version with no dots, ex: 1070 + MAC_FLAGS = -mmacosx-version-min=$(MACOSX_VERSION_MIN) CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \ - -mmacosx-version-min=$(MACOSX_VERSION_MIN) - LFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) + $(MAC_FLAGS) + LFLAGS += $(MAC_FLAGS) endif diff --git a/hotspot/make/bsd/makefiles/jsig.make b/hotspot/make/bsd/makefiles/jsig.make index 5cfb899572..800a04b3a3 100644 --- a/hotspot/make/bsd/makefiles/jsig.make +++ b/hotspot/make/bsd/makefiles/jsig.make @@ -54,9 +54,9 @@ LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig LFLAGS_JSIG += -D_GNU_SOURCE -pthread $(LDFLAGS_HASH_STYLE) $(EXTRA_LDFLAGS) -ifeq ($(OS_VENDOR), Darwin) # bring in minimum version argument or we'll fail on OSX 10.10 -LFLAGS_JSIG += $(LFLAGS) +ifeq ($(OS_VENDOR), Darwin) + LFLAGS_JSIG += $(MAC_FLAGS) endif # DEBUG_BINARIES overrides everything, use full -g debug information diff --git a/hotspot/make/bsd/makefiles/saproc.make b/hotspot/make/bsd/makefiles/saproc.make index 5c837895f6..41d062e528 100644 --- a/hotspot/make/bsd/makefiles/saproc.make +++ b/hotspot/make/bsd/makefiles/saproc.make @@ -111,10 +111,10 @@ endif ifneq ($(OS_VENDOR), Darwin) -SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) + SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) else -# bring in minimum version argument or we'll fail on OSX 10.10 -SA_LFLAGS = $(LFLAGS) + # bring in minimum version argument or we'll fail on OSX 10.10 + SA_LFLAGS = $(MAC_FLAGS) endif SA_LFLAGS += $(LDFLAGS_HASH_STYLE) $(EXTRA_LDFLAGS) From db8782c220e2a50b8f589654910c3263fb48edb2 Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Mon, 12 Jan 2026 23:37:47 +0000 Subject: [PATCH 7/7] Backport 73d9ca12627898f0e3179ba2271bd2d7bfb5d642 --- .../agent/src/os/bsd/MacosxDebuggerLocal.m | 51 ++++++++++++++++--- hotspot/make/bsd/makefiles/saproc.make | 12 ----- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m index adc10f31a7..e0d7e5e6a3 100644 --- a/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m +++ b/hotspot/agent/src/os/bsd/MacosxDebuggerLocal.m @@ -24,7 +24,6 @@ #include #import -#import #include @@ -196,6 +195,39 @@ jlong lookupByNameIncore( return addr; } +/* Create a pool and initiate a try block to catch any exception */ +#define JNI_COCOA_ENTER(env) \ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \ + @try { + +/* Don't allow NSExceptions to escape to Java. + * If there is a Java exception that has been thrown that should escape. + * And ensure we drain the auto-release pool. + */ +#define JNI_COCOA_EXIT(env) \ + } \ + @catch (NSException *e) { \ + NSLog(@"%@", [e callStackSymbols]); \ + } \ + @finally { \ + [pool drain]; \ + }; + +static NSString* JavaStringToNSString(JNIEnv *env, jstring jstr) { + + if (jstr == NULL) { + return NULL; + } + jsize len = (*env)->GetStringLength(env, jstr); + const jchar *chars = (*env)->GetStringChars(env, jstr, NULL); + if (chars == NULL) { + return NULL; + } + NSString *result = [NSString stringWithCharacters:(UniChar *)chars length:len]; + (*env)->ReleaseStringChars(env, jstr, chars); + return result; +} + /* * Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal * Method: lookupByName0 @@ -213,8 +245,9 @@ jlong lookupByNameIncore( jlong address = 0; -JNF_COCOA_ENTER(env); - NSString *symbolNameString = JNFJavaToNSString(env, symbolName); + JNI_COCOA_ENTER(env); + + NSString *symbolNameString = JavaStringToNSString(env, symbolName); print_debug("lookupInProcess called for %s\n", [symbolNameString UTF8String]); @@ -225,7 +258,7 @@ jlong lookupByNameIncore( } print_debug("address of symbol %s = %llx\n", [symbolNameString UTF8String], address); -JNF_COCOA_EXIT(env); + JNI_COCOA_EXIT(env); return address; } @@ -707,7 +740,7 @@ static bool ptrace_attach(pid_t pid) { { print_debug("attach0 called for jpid=%d\n", (int)jpid); -JNF_COCOA_ENTER(env); + JNI_COCOA_ENTER(env); kern_return_t result; task_t gTask = 0; @@ -740,7 +773,7 @@ static bool ptrace_attach(pid_t pid) { THROW_NEW_DEBUGGER_EXCEPTION("Can't attach symbolicator to the process"); } -JNF_COCOA_EXIT(env); + JNI_COCOA_EXIT(env); } /** For core file, @@ -818,7 +851,9 @@ static void fillLoadObjects(JNIEnv* env, jobject this_obj, struct ps_prochandle* Prelease(ph); return; } -JNF_COCOA_ENTER(env); + + JNI_COCOA_ENTER(env); + task_t gTask = getTask(env, this_obj); // detach from the ptraced process causing it to resume execution @@ -840,5 +875,5 @@ static void fillLoadObjects(JNIEnv* env, jobject this_obj, struct ps_prochandle* if (symbolicator != nil) { CFRelease(symbolicator); } -JNF_COCOA_EXIT(env); + JNI_COCOA_EXIT(env); } diff --git a/hotspot/make/bsd/makefiles/saproc.make b/hotspot/make/bsd/makefiles/saproc.make index 41d062e528..cc0e2dfe4a 100644 --- a/hotspot/make/bsd/makefiles/saproc.make +++ b/hotspot/make/bsd/makefiles/saproc.make @@ -66,22 +66,10 @@ else SASRCFILES = $(DARWIN_NON_STUB_SASRCFILES) SALIBS = -g \ -framework Foundation \ - -framework JavaNativeFoundation \ -framework Security \ -framework CoreFoundation #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles? SAARCH = $(subst -march=i586,,$(ARCHFLAG)) - - # This is needed to locate JavaNativeFoundation.framework - # JDK 8 doesn't have SYSROOT_CFLAGS, so we'll cobble it together here - SA_SYSROOT_FLAGS= - ifneq ($(SDKPATH),) - SA_SYSROOT_FLAGS += -isysroot "$(SDKPATH)" -iframework"$(SDKPATH)/System/Library/Frameworks" - endif - ifneq ($(wildcard "$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks"), "") - # always needed, even if SDKPATH is empty - SA_SYSROOT_FLAGS += -F"$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks" - endif else SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c SALIBS =