--- a/make/autoconf/flags-cflags.m4 Tue Oct 29 14:22:18 2019 -0400
+++ b/make/autoconf/flags-cflags.m4 Tue Oct 29 12:01:14 2019 -0700
@@ -694,6 +694,20 @@
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
fi
fi
+
+ # Extra flags needed when building optional static versions of certain
+ # JDK libraries.
+ STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
+ STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections"
+ fi
+ if test "x$TOOLCHAIN_TYPE" = xgcc; then
+ # Disable relax-relocation to enable compatibility with older linkers
+ RELAX_RELOCATIONS_FLAG="-Xassembler -mrelax-relocations=no"
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${RELAX_RELOCATIONS_FLAG}],
+ IF_TRUE: [STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS ${RELAX_RELOCATIONS_FLAG}"])
+ fi
+ AC_SUBST(STATIC_LIBS_CFLAGS)
])
################################################################################