8234809: set relro in linker flags when building with gcc

Reviewed-by: erikj, fweimer
This commit is contained in:
Matthias Baesken 2019-11-26 13:55:11 +01:00
parent 229e0d1631
commit bdd67c46f3

View File

@ -70,10 +70,9 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
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 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
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