< prev index next >

make/autoconf/flags-cflags.m4

Print this page
@@ -26,20 +26,23 @@
  ################################################################################
  #
  # Setup flags for C/C++ compiler
  #
  
- ###############################################################################
+ ################################################################################
  #
  # How to compile shared libraries.
  #
  AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
  [
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
      # Default works for linux, might work on other platforms as well.
      SHARED_LIBRARY_FLAGS='-shared'
-     SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
+     # --disable-new-dtags forces use of RPATH instead of RUNPATH for rpaths.
+     # This protects internal library dependencies within the JDK from being
+     # overridden using LD_LIBRARY_PATH. See JDK-8326891 for more information.
+     SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1 -Wl,--disable-new-dtags'
      SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
      SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
      SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
  
    elif test "x$TOOLCHAIN_TYPE" = xclang; then

@@ -61,10 +64,13 @@
  
      else
        # Default works for linux, might work on other platforms as well.
        SHARED_LIBRARY_FLAGS='-shared'
        SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
+       if test "x$OPENJDK_TARGET_OS" = xlinux; then
+         SET_EXECUTABLE_ORIGIN="$SET_EXECUTABLE_ORIGIN -Wl,--disable-new-dtags"
+       fi
        SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
        SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
  
        # arm specific settings
        if test "x$OPENJDK_TARGET_CPU" = "xarm"; then

@@ -120,10 +126,15 @@
          ],
          IF_TRUE: [
              # Add debug prefix map gcc system include paths, as they cause
              # non-deterministic debug paths depending on gcc path location.
              DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS
+ 
+             # Add debug prefix map for OUTPUTDIR to handle the scenario when
+             # it is not located within WORKSPACE_ROOT
+             outputdir_slash="${OUTPUTDIR%/}/"
+             DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=${outputdir_slash}="
          ]
        )
      fi
  
      CFLAGS_DEBUG_SYMBOLS="-g -gdwarf-4"

@@ -483,11 +494,11 @@
      CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
    elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
      CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
      CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
    elif test "x$OPENJDK_TARGET_OS" = xaix; then
-     CFLAGS_OS_DEF_JVM="-DAIX"
+     CFLAGS_OS_DEF_JVM="-DAIX -D_LARGE_FILES"
    elif test "x$OPENJDK_TARGET_OS" = xbsd; then
      CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
    elif test "x$OPENJDK_TARGET_OS" = xwindows; then
      CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
    fi
< prev index next >