From d3f01e67fbb091d2356ae9700342e21635aa1ba6 Mon Sep 17 00:00:00 2001 From: alvdavi Date: Mon, 6 Apr 2020 01:58:35 +0100 Subject: [PATCH] 8233410: Better Build Scripting Reviewed-by: andrew --- common/autoconf/flags.m4 | 11 +++++++++-- common/autoconf/generated-configure.sh | 13 ++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 index fe0d9a4..1f3b255 100644 --- a/common/autoconf/flags.m4 +++ b/common/autoconf/flags.m4 @@ -156,6 +156,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], if test "x$TOOLCHAIN_TYPE" = xgcc; then PICFLAG="-fPIC" + PIEFLAG="-fPIE" C_FLAG_REORDER='' CXX_FLAG_REORDER='' @@ -176,6 +177,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], fi elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then PICFLAG="-KPIC" + PIEFLAG="" C_FLAG_REORDER='-xF' CXX_FLAG_REORDER='-xF' SHARED_LIBRARY_FLAGS="-G" @@ -185,6 +187,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], SET_SHARED_LIBRARY_MAPFILE='-M[$]1' elif test "x$TOOLCHAIN_TYPE" = xxlc; then PICFLAG="-qpic=large" + PIEFLAG="" C_FLAG_REORDER='' CXX_FLAG_REORDER='' SHARED_LIBRARY_FLAGS="-qmkshrobj" @@ -194,6 +197,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS], SET_SHARED_LIBRARY_MAPFILE='' elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then PICFLAG="" + PIEFLAG="" C_FLAG_REORDER='' CXX_FLAG_REORDER='' SHARED_LIBRARY_FLAGS="-LD" @@ -658,8 +662,8 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " # Executable flags - CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" - CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" + CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK $PIEFLAG" + CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PIEFLAG" AC_SUBST(CFLAGS_JDKLIB) AC_SUBST(CFLAGS_JDKEXE) @@ -742,6 +746,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], if test "x$OPENJDK_TARGET_OS" = xlinux; then LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined" fi + if test "x$TOOLCHAIN_TYPE" = xgcc; then + LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -pie" + fi fi AC_SUBST(LDFLAGS_JDKLIB) AC_SUBST(LDFLAGS_JDKEXE) diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index 33690e7..a743a5b 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -4379,7 +4379,7 @@ VS_SDK_PLATFORM_NAME_2017= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1580709484 +DATE_WHEN_GENERATED=1585090811 ############################################################################### # @@ -41236,6 +41236,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; } if test "x$TOOLCHAIN_TYPE" = xgcc; then PICFLAG="-fPIC" + PIEFLAG="-fPIE" C_FLAG_REORDER='' CXX_FLAG_REORDER='' @@ -41256,6 +41257,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; } fi elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then PICFLAG="-KPIC" + PIEFLAG="" C_FLAG_REORDER='-xF' CXX_FLAG_REORDER='-xF' SHARED_LIBRARY_FLAGS="-G" @@ -41265,6 +41267,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; } SET_SHARED_LIBRARY_MAPFILE='-M$1' elif test "x$TOOLCHAIN_TYPE" = xxlc; then PICFLAG="-qpic=large" + PIEFLAG="" C_FLAG_REORDER='' CXX_FLAG_REORDER='' SHARED_LIBRARY_FLAGS="-qmkshrobj" @@ -41274,6 +41277,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; } SET_SHARED_LIBRARY_MAPFILE='' elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then PICFLAG="" + PIEFLAG="" C_FLAG_REORDER='' CXX_FLAG_REORDER='' SHARED_LIBRARY_FLAGS="-LD" @@ -42088,8 +42092,8 @@ $as_echo "$supports" >&6; } CXXFLAGS_JDKLIB="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PICFLAG $CXXFLAGS_JDKLIB_EXTRA " # Executable flags - CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK" - CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK" + CFLAGS_JDKEXE="$CCXXFLAGS_JDK $CFLAGS_JDK $PIEFLAG" + CXXFLAGS_JDKEXE="$CCXXFLAGS_JDK $CXXFLAGS_JDK $PIEFLAG" @@ -42172,6 +42176,9 @@ $as_echo "$supports" >&6; } if test "x$OPENJDK_TARGET_OS" = xlinux; then LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -Xlinker --allow-shlib-undefined" fi + if test "x$TOOLCHAIN_TYPE" = xgcc; then + LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE -pie" + fi fi -- GitLab