# HG changeset patch # User mbaesken # Date 1574845649 -3600 # Node ID c04fa10636fd35d7abfc899da1d0fda39c015052 # Parent a2441ac23eebf9a7a5bb70e1873ab8b43f149f88 8234525: enable link-time section-gc for linux s390x to remove unused code Reviewed-by: erikj, mdoerr diff -r a2441ac23eeb -r c04fa10636fd make/autoconf/flags-cflags.m4 --- a/make/autoconf/flags-cflags.m4 Tue Nov 26 13:55:11 2019 +0100 +++ b/make/autoconf/flags-cflags.m4 Wed Nov 27 10:07:29 2019 +0100 @@ -532,6 +532,11 @@ if test "x$TOOLCHAIN_TYPE" = xgcc; then TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector" TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector" + # reduce lib size on s390x in link step, this needs also special compile flags + if test "x$OPENJDK_TARGET_CPU" = xs390x; then + TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -ffunction-sections -fdata-sections" + TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -ffunction-sections -fdata-sections" + fi # technically NOT for CXX (but since this gives *worse* performance, use # no-strict-aliasing everywhere!) TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" diff -r a2441ac23eeb -r c04fa10636fd make/autoconf/flags-ldflags.m4 --- a/make/autoconf/flags-ldflags.m4 Tue Nov 26 13:55:11 2019 +0100 +++ b/make/autoconf/flags-ldflags.m4 Wed Nov 27 10:07:29 2019 +0100 @@ -72,6 +72,11 @@ # Add -z defs, to forbid undefined symbols in object files. # add relro (mark relocations read only) for all libs BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs -Wl,-z,relro" + # s390x : remove unused code+data in link step + if test "x$OPENJDK_TARGET_CPU" = xs390x; then + BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,--gc-sections -Wl,--print-gc-sections" + fi + BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1" elif test "x$TOOLCHAIN_TYPE" = xclang; then