8200738: Use --hash-style=gnu for gcc

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2020-06-12 20:28:07 +02:00
parent 0e4829ef0a
commit 1a681a434f
3 changed files with 1 additions and 19 deletions

View File

@ -62,17 +62,10 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
[
# Setup basic LDFLAGS
if test "x$TOOLCHAIN_TYPE" = xgcc; then
# If this is a --hash-style=gnu system, use --hash-style=both, why?
# We have previously set HAS_GNU_HASH if this is the case
if test -n "$HAS_GNU_HASH"; then
BASIC_LDFLAGS="-Wl,--hash-style=both"
LIBJSIG_HASHSTYLE_LDFLAGS="-Wl,--hash-style=both"
fi
# Add -z,defs, to forbid undefined symbols in object files.
# add -z,relro (mark relocations read only) for all libs
# add -z,now ("full relro" - more of the Global Offset Table GOT is marked read only)
BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs -Wl,-z,relro -Wl,-z,now"
BASIC_LDFLAGS="-Wl,--hash-style=gnu -Wl,-z,defs -Wl,-z,relro -Wl,-z,now"
# Linux : remove unused code+data in link step
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
if test "x$OPENJDK_TARGET_CPU" = xs390x; then
@ -152,8 +145,6 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
# Export some intermediate variables for compatibility
LDFLAGS_CXX_JDK="$BASIC_LDFLAGS_ONLYCXX $BASIC_LDFLAGS_ONLYCXX_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY"
AC_SUBST(LDFLAGS_CXX_JDK)
AC_SUBST(LIBJSIG_HASHSTYLE_LDFLAGS)
AC_SUBST(LIBJSIG_NOEXECSTACK_LDFLAGS)
])
################################################################################

View File

@ -489,9 +489,6 @@ CXXFLAGS_JDKLIB:=@CXXFLAGS_JDKLIB@
CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@
CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
LIBJSIG_HASHSTYLE_LDFLAGS := @LIBJSIG_HASHSTYLE_LDFLAGS@
LIBJSIG_NOEXECSTACK_LDFLAGS := @LIBJSIG_NOEXECSTACK_LDFLAGS@
FDLIBM_CFLAGS := @FDLIBM_CFLAGS@
JVM_CFLAGS := @JVM_CFLAGS@
JVM_LDFLAGS := @JVM_LDFLAGS@

View File

@ -972,12 +972,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
fi
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
# If this is a --hash-style=gnu system, use --hash-style=both, why?
HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
# This is later checked when setting flags.
fi
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# Check if linker has -z noexecstack.
HAS_NOEXECSTACK=`$CC -Wl,--help 2>/dev/null | $GREP 'z noexecstack'`