# HG changeset patch # User mbaesken # Date 1574772911 -3600 # Node ID a2441ac23eebf9a7a5bb70e1873ab8b43f149f88 # Parent 7799a51dbe30736ca12e007af5ba96a7bb610010 8234809: set relro in linker flags when building with gcc Reviewed-by: erikj, fweimer diff -r 7799a51dbe30 -r a2441ac23eeb make/autoconf/flags-ldflags.m4 --- a/make/autoconf/flags-ldflags.m4 Wed Nov 27 09:00:01 2019 +0100 +++ b/make/autoconf/flags-ldflags.m4 Tue Nov 26 13:55:11 2019 +0100 @@ -70,10 +70,9 @@ fi # Add -z defs, to forbid undefined symbols in object files. - BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs" - - BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1 -Wl,-z,relro" - + # add relro (mark relocations read only) for all libs + BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs -Wl,-z,relro" + BASIC_LDFLAGS_JVM_ONLY="-Wl,-O1" elif test "x$TOOLCHAIN_TYPE" = xclang; then BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \ @@ -120,9 +119,6 @@ if test "x$OPENJDK_TARGET_OS" = xlinux; then if test x$DEBUG_LEVEL = xrelease; then DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1" - else - # mark relocations read only on (fast/slow) debug builds - DEBUGLEVEL_LDFLAGS_JDK_ONLY="-Wl,-z,relro" fi if test x$DEBUG_LEVEL = xslowdebug; then # do relocations at load