changeset 49261:07531d66c761

Merge
author mikael
date Fri, 16 Mar 2018 15:59:12 -0700
parents ff7c335430d4 055b2c860236
children 678bad6ee7a5
files make/ReleaseFile.gmk make/autoconf/buildjdk-spec.gmk.in make/autoconf/configure.ac make/autoconf/hotspot.m4 make/autoconf/platform.m4 make/autoconf/spec.gmk.in make/conf/jib-profiles.js make/hotspot/lib/CompileJvm.gmk make/lib/CoreLibraries.gmk make/lib/Lib-jdk.hotspot.agent.gmk src/hotspot/os/linux/os_linux.cpp src/hotspot/share/runtime/vm_version.cpp
diffstat 27 files changed, 395 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/make/ReleaseFile.gmk	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/ReleaseFile.gmk	Fri Mar 16 15:59:12 2018 -0700
@@ -53,6 +53,7 @@
   $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
   $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
   $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
+  $(call info-file-item, "LIBC", "$(OPENJDK_TARGET_LIBC)")
 endef
 
 # Param 1 - The file containing the MODULES list
--- a/make/autoconf/build-aux/config.guess	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/build-aux/config.guess	Fri Mar 16 15:59:12 2018 -0700
@@ -30,6 +30,17 @@
 DIR=`dirname $0`
 OUT=`. $DIR/autoconf-config.guess`
 
+# config.guess doesn't identify systems running the musl C library, and will
+# instead return a string with a -gnu suffix. This block detects musl and
+# modifies the string to have a -musl suffix instead. 
+echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
+if test $? = 0; then
+  ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
+  if [ x"${ldd_version}" = x"musl" ]; then
+    OUT=`echo $OUT | sed 's/-gnu/-musl/'`
+  fi
+fi
+
 # Test and fix solaris on x86_64
 echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
 if test $? = 0; then
--- a/make/autoconf/build-aux/config.sub	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/build-aux/config.sub	Fri Mar 16 15:59:12 2018 -0700
@@ -29,6 +29,11 @@
 
 DIR=`dirname $0`
 
+if [ "$1"x = "x86_64-unknown-linux-musl"x ]; then
+    echo $1
+    exit
+fi
+
 # First, filter out everything that doesn't begin with "aarch64-"
 if ! echo $* | grep '^aarch64-' >/dev/null ; then
     . $DIR/autoconf-config.sub "$@"
--- a/make/autoconf/buildjdk-spec.gmk.in	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/buildjdk-spec.gmk.in	Fri Mar 16 15:59:12 2018 -0700
@@ -50,11 +50,13 @@
 
 OPENJDK_BUILD_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
 OPENJDK_BUILD_CPU_LEGACY_LIB := @OPENJDK_BUILD_CPU_LEGACY_LIB@
+OPENJDK_BUILD_LIBC := @OPENJDK_BUILD_LIBC@
 OPENJDK_TARGET_CPU := @OPENJDK_BUILD_CPU@
 OPENJDK_TARGET_CPU_ARCH := @OPENJDK_BUILD_CPU_ARCH@
 OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
 OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
 OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
+OPENJDK_TARGET_LIBC := @OPENJDK_BUILD_LIBC@
 OPENJDK_TARGET_OS_INCLUDE_SUBDIR := @OPENJDK_BUILD_OS_INCLUDE_SUBDIR@
 
 HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
@@ -62,6 +64,7 @@
 HOTSPOT_TARGET_CPU := @HOTSPOT_BUILD_CPU@
 HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_BUILD_CPU_ARCH@
 HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_BUILD_CPU_DEFINE@
+HOTSPOT_TARGET_LIBC := @HOTSPOT_BUILD_LIBC@
 
 CFLAGS_JDKLIB := @OPENJDK_BUILD_CFLAGS_JDKLIB@
 CXXFLAGS_JDKLIB := @OPENJDK_BUILD_CXXFLAGS_JDKLIB@
--- a/make/autoconf/configure.ac	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/configure.ac	Fri Mar 16 15:59:12 2018 -0700
@@ -202,6 +202,7 @@
 
 # Need toolchain to setup dtrace
 HOTSPOT_SETUP_DTRACE
+HOTSPOT_SETUP_SA
 HOTSPOT_ENABLE_DISABLE_AOT
 HOTSPOT_ENABLE_DISABLE_CDS
 HOTSPOT_ENABLE_DISABLE_GTEST
--- a/make/autoconf/hotspot.m4	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/hotspot.m4	Fri Mar 16 15:59:12 2018 -0700
@@ -259,6 +259,50 @@
 ])
 
 ###############################################################################
+# Check if the serviceability agent attach functionality should be included.
+#
+AC_DEFUN_ONCE([HOTSPOT_SETUP_SA],
+[
+  # Test for serviceability agent attach dependencies
+  AC_ARG_ENABLE([sa-attach], [AS_HELP_STRING([--enable-sa-attach@<:@=yes/no/auto@:>@],
+      [enable serviceability agent attach. Default is auto, where it is enabled if all dependencies
+      are present.])])
+
+  SA_ATTACH_DEP_MISSING=false
+
+  AC_CHECK_HEADERS([thread_db.h], [SA_ATTACH_HEADERS_OK=yes],[SA_ATTACH_HEADERS_OK=no])
+  if test "x$SA_ATTACH_HEADERS_OK" != "xyes"; then
+    SA_ATTACH_DEP_MISSING=true
+  fi
+
+  AC_MSG_CHECKING([if serviceability agent attach should be included])
+  if test "x$enable_sa_attach" = "xyes"; then
+    if test "x$SA_ATTACH_DEP_MISSING" = "xtrue"; then
+      AC_MSG_RESULT([no, missing dependencies])
+      HELP_MSG_MISSING_DEPENDENCY([sa-attach])
+      AC_MSG_ERROR([Cannot enable sa-attach with missing dependencies. See above. $HELP_MSG])
+    else
+      INCLUDE_SA_ATTACH=true
+      AC_MSG_RESULT([yes, forced])
+    fi
+  elif test "x$enable_sa_attach" = "xno"; then
+    INCLUDE_SA_ATTACH=false
+    AC_MSG_RESULT([no, forced])
+  elif test "x$enable_sa_attach" = "xauto" || test "x$enable_sa_attach" = "x"; then
+    if test "x$SA_ATTACH_DEP_MISSING" = "xtrue"; then
+      INCLUDE_SA_ATTACH=false
+      AC_MSG_RESULT([no, missing dependencies])
+    else
+      INCLUDE_SA_ATTACH=true
+      AC_MSG_RESULT([yes, dependencies present])
+    fi
+  else
+    AC_MSG_ERROR([Invalid value for --enable-sa-attach: $enable_sa_attach])
+  fi
+  AC_SUBST(INCLUDE_SA_ATTACH)
+])
+
+###############################################################################
 # Set up all JVM features for each JVM variant.
 #
 AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
--- a/make/autoconf/platform.m4	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/platform.m4	Fri Mar 16 15:59:12 2018 -0700
@@ -188,6 +188,18 @@
       AC_MSG_ERROR([unsupported operating system $1])
       ;;
   esac
+
+  case "$1" in
+    *linux*-musl)
+      VAR_LIBC=musl
+      ;;
+    *linux*-gnu)
+      VAR_LIBC=gnu
+      ;;
+    *)
+      VAR_LIBC=default
+      ;;
+  esac
 ])
 
 # Expects $host_os $host_cpu $build_os and $build_cpu
@@ -226,6 +238,7 @@
   OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
   OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
   OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
+  OPENJDK_BUILD_LIBC="$VAR_LIBC"
   AC_SUBST(OPENJDK_BUILD_OS)
   AC_SUBST(OPENJDK_BUILD_OS_TYPE)
   AC_SUBST(OPENJDK_BUILD_OS_ENV)
@@ -233,10 +246,16 @@
   AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
   AC_SUBST(OPENJDK_BUILD_CPU_BITS)
   AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
+  AC_SUBST(OPENJDK_BUILD_LIBC)
 
   AC_MSG_CHECKING([openjdk-build os-cpu])
   AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
 
+  if test "x$OPENJDK_BUILD_OS" = "xlinux"; then
+    AC_MSG_CHECKING([openjdk-build C library])
+    AC_MSG_RESULT([$OPENJDK_BUILD_LIBC])
+  fi
+
   # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
   PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
   PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
@@ -256,6 +275,7 @@
   OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
   OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
   OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
+  OPENJDK_TARGET_LIBC="$VAR_LIBC"
   AC_SUBST(OPENJDK_TARGET_OS)
   AC_SUBST(OPENJDK_TARGET_OS_TYPE)
   AC_SUBST(OPENJDK_TARGET_OS_ENV)
@@ -263,9 +283,15 @@
   AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
   AC_SUBST(OPENJDK_TARGET_CPU_BITS)
   AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
+  AC_SUBST(OPENJDK_TARGET_LIBC)
 
   AC_MSG_CHECKING([openjdk-target os-cpu])
   AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
+
+  if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
+    AC_MSG_CHECKING([openjdk-target C library])
+    AC_MSG_RESULT([$OPENJDK_TARGET_LIBC])
+  fi
 ])
 
 # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
@@ -400,7 +426,13 @@
   else
     OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU"
   fi
-  OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}"
+
+  OPENJDK_$1_LIBC_BUNDLE=""
+  if test "x$OPENJDK_$1_LIBC" = "xmusl"; then  
+    OPENJDK_$1_LIBC_BUNDLE="-$OPENJDK_$1_LIBC"
+  fi
+
+  OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}${OPENJDK_$1_LIBC_BUNDLE}"
   AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM)
 
   if test "x$COMPILE_TYPE" = "xcross"; then
@@ -469,6 +501,13 @@
   fi
   AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
 
+  if test "x$OPENJDK_$1_LIBC" = "xmusl"; then
+    HOTSPOT_$1_LIBC=$OPENJDK_$1_LIBC
+  else
+    HOTSPOT_$1_LIBC=""
+  fi
+  AC_SUBST(HOTSPOT_$1_LIBC)
+
   # For historical reasons, the OS include directories have odd names.
   OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
--- a/make/autoconf/spec.gmk.in	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/autoconf/spec.gmk.in	Fri Mar 16 15:59:12 2018 -0700
@@ -71,6 +71,8 @@
 OPENJDK_TARGET_CPU_BITS:=@OPENJDK_TARGET_CPU_BITS@
 OPENJDK_TARGET_CPU_ENDIAN:=@OPENJDK_TARGET_CPU_ENDIAN@
 
+OPENJDK_TARGET_LIBC:=@OPENJDK_TARGET_LIBC@
+
 COMPILE_TYPE:=@COMPILE_TYPE@
 
 # Legacy support
@@ -87,6 +89,8 @@
 HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_TARGET_CPU_ARCH@
 HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_TARGET_CPU_DEFINE@
 
+HOTSPOT_TARGET_LIBC := @HOTSPOT_TARGET_LIBC@
+
 OPENJDK_TARGET_BUNDLE_PLATFORM:=@OPENJDK_TARGET_BUNDLE_PLATFORM@
 JDK_ARCH_ABI_PROP_NAME := @JDK_ARCH_ABI_PROP_NAME@
 
@@ -101,6 +105,8 @@
 OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
 OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
 
+OPENJDK_BUILD_LIBC:=@OPENJDK_BUILD_LIBC@
+
 OPENJDK_BUILD_OS_INCLUDE_SUBIDR:=@OPENJDK_TARGET_OS_INCLUDE_SUBDIR@
 
 # Target platform value in ModuleTarget class file attribute.
@@ -810,6 +816,7 @@
 #
 
 INCLUDE_SA=@INCLUDE_SA@
+INCLUDE_SA_ATTACH=@INCLUDE_SA_ATTACH@
 INCLUDE_GRAAL=@INCLUDE_GRAAL@
 
 OS_VERSION_MAJOR:=@OS_VERSION_MAJOR@
--- a/make/conf/jib-profiles.js	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/conf/jib-profiles.js	Fri Mar 16 15:59:12 2018 -0700
@@ -58,8 +58,10 @@
  * input.build_id
  * input.target_os
  * input.target_cpu
+ * input.target_libc
  * input.build_os
  * input.build_cpu
+ * input.build_libc
  * input.target_platform
  * input.build_platform
  * // The build_osenv_* variables describe the unix layer on Windows systems,
@@ -99,13 +101,17 @@
  *       target_os; <string>
  *       // Name of cpu the profile is built to run on
  *       target_cpu; <string>
- *       // Combination of target_os and target_cpu for convenience
+ *       // Optional libc string if non standard
+ *       target_libc; <string>
+ *       // Optional combination of target_os and target_cpu for convenience
  *       target_platform; <string>
  *       // Name of os the profile is built on
  *       build_os; <string>
  *       // Name of cpu the profile is built on
  *       build_cpu; <string>
- *       // Combination of build_os and build_cpu for convenience
+ *       // Optional libc string if non standard
+ *       build_libc; <string>
+ *       // Optional combination of build_os and build_cpu for convenience
  *       build_platform; <string>
  *
  *       // List of dependencies needed to build this profile
@@ -230,7 +236,7 @@
 
     // List of the main profile names used for iteration
     common.main_profile_names = [
-        "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
+        "linux-x64", "linux-x64-musl", "linux-x86", "macosx-x64", "solaris-x64",
         "solaris-sparcv9", "windows-x64", "windows-x86",
         "linux-aarch64", "linux-arm64", "linux-arm-vfp-hflt",
         "linux-arm-vfp-hflt-dyn"
@@ -418,6 +424,14 @@
             default_make_targets: ["docs-bundles"],
         },
 
+        "linux-x64-musl": {
+            target_os: "linux",
+            target_cpu: "x64",
+            target_libc: "musl",
+            configure_args: concat(common.configure_args_64bit,
+                "--with-zlib=system"),
+        },
+
         "linux-x86": {
             target_os: "linux",
             target_cpu: "x86",
@@ -599,6 +613,10 @@
         "linux-x64": {
             platform: "linux-x64",
         },
+        "linux-x64-musl": {
+            platform: "linux-x64-musl",
+            demo_ext: "tar.gz"
+        },
         "linux-x86": {
             platform: "linux-x86",
         },
@@ -834,7 +852,16 @@
         : input.target_platform);
 
     var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
-        + "-" + input.build_cpu;
+        + "-" + input.build_cpu +
+        (input.build_libc ? "-" + input.build_libc : "");
+
+    var boot_jdk_version = common.boot_jdk_version;
+    var boot_jdk_build_number = "181";
+
+    if (input.build_libc == "musl") {
+        boot_jdk_version = "jdk9-alpine";
+        boot_jdk_build_number = "181_2017-08-07-2007_6744";
+    }
 
     var makeBinDir = (input.build_os == "windows"
         ? input.get("gnumake", "install_path") + "/cygwin/bin"
@@ -845,8 +872,8 @@
         boot_jdk: {
             server: "jpg",
             product: "jdk",
-            version: common.boot_jdk_version,
-            build_number: "181",
+            version: boot_jdk_version,
+            build_number: boot_jdk_build_number,
             file: "bundles/" + boot_jdk_platform + "/jdk-" + common.boot_jdk_version + "_"
                 + boot_jdk_platform + "_bin.tar.gz",
             configure_args: "--with-boot-jdk=" + common.boot_jdk_home,
--- a/make/hotspot/lib/CompileJvm.gmk	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/hotspot/lib/CompileJvm.gmk	Fri Mar 16 15:59:12 2018 -0700
@@ -133,6 +133,10 @@
   OPENJDK_TARGET_CPU_VM_VERSION := $(OPENJDK_TARGET_CPU)
 endif
 
+ifneq ($(HOTSPOT_TARGET_LIBC),)
+  LIBC_DEFINE := -DHOTSPOT_LIBC='"$(HOTSPOT_TARGET_LIBC)"'
+endif
+
 CFLAGS_VM_VERSION := \
     $(VERSION_CFLAGS) \
     -DHOTSPOT_VERSION_STRING='"$(VERSION_STRING)"' \
@@ -140,6 +144,7 @@
     -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
     -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
     -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
+    $(LIBC_DEFINE) \
     #
 
 # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
--- a/make/lib/CoreLibraries.gmk	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/lib/CoreLibraries.gmk	Fri Mar 16 15:59:12 2018 -0700
@@ -313,6 +313,9 @@
   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
 endif
 
+
+LIBJLI_CFLAGS += -DLIBC=\"$(OPENJDK_TARGET_LIBC)\"
+
 LIBJLI_CFLAGS += $(addprefix -I, $(LIBJLI_SRC_DIRS))
 
 LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Fri Mar 16 03:17:12 2018 -0700
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Fri Mar 16 15:59:12 2018 -0700
@@ -52,7 +52,9 @@
     SA_LDFLAGS := -march=i586
   endif
 
-  SA_LIBS := -lthread_db $(LIBDL)
+  ifeq ($(INCLUDE_SA_ATTACH), true)
+    SA_LIBS := -lthread_db $(LIBDL)
+  endif
 
 else ifeq ($(OPENJDK_TARGET_OS), solaris)
   SA_TOOLCHAIN := TOOLCHAIN_LINK_CXX
@@ -85,6 +87,12 @@
   endif
 endif
 
+ifeq ($(INCLUDE_SA_ATTACH), true)
+  SA_CFLAGS += -DINCLUDE_SA_ATTACH
+endif
+
+SA_CFLAGS += -DLIBC=\"$(OPENJDK_TARGET_LIBC)\"
+
 ################################################################################
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
--- a/src/hotspot/os/linux/os_linux.cpp	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp	Fri Mar 16 15:59:12 2018 -0700
@@ -99,7 +99,6 @@
 # include <string.h>
 # include <syscall.h>
 # include <sys/sysinfo.h>
-# include <gnu/libc-version.h>
 # include <sys/ipc.h>
 # include <sys/shm.h>
 # include <link.h>
@@ -145,8 +144,8 @@
 int os::Linux::_page_size = -1;
 bool os::Linux::_supports_fast_thread_cpu_time = false;
 uint32_t os::Linux::_os_version = 0;
-const char * os::Linux::_glibc_version = NULL;
-const char * os::Linux::_libpthread_version = NULL;
+const char * os::Linux::_glibc_version = "unknown";
+const char * os::Linux::_libpthread_version = "unknown";
 
 static jlong initial_time_count=0;
 
@@ -522,17 +521,21 @@
   #error "glibc too old (< 2.3.2)"
 #endif
 
-  size_t n = confstr(_CS_GNU_LIBC_VERSION, NULL, 0);
-  assert(n > 0, "cannot retrieve glibc version");
-  char *str = (char *)malloc(n, mtInternal);
-  confstr(_CS_GNU_LIBC_VERSION, str, n);
-  os::Linux::set_glibc_version(str);
+  size_t n;
+
+  n = confstr(_CS_GNU_LIBC_VERSION, NULL, 0);
+  if (n > 0) {
+    char* str = (char *)malloc(n, mtInternal);
+    confstr(_CS_GNU_LIBC_VERSION, str, n);
+    os::Linux::set_glibc_version(str);
+  }
 
   n = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
-  assert(n > 0, "cannot retrieve pthread version");
-  str = (char *)malloc(n, mtInternal);
-  confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
-  os::Linux::set_libpthread_version(str);
+  if (n > 0) {
+    char* str = (char *)malloc(n, mtInternal);
+    confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+    os::Linux::set_libpthread_version(str);
+  }
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -2879,20 +2882,36 @@
 extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
 extern "C" JNIEXPORT void numa_error(char *where) { }
 
+static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
+  typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
+  static dlvsym_func_type dlvsym_func;
+  static bool initialized = false;
+
+  if (!initialized) {
+    dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
+    initialized = true;
+  }
+
+  if (dlvsym_func != NULL) {
+    void *f = dlvsym_func(handle, name, version);
+    if (f != NULL) {
+      return f;
+    }
+  }
+
+  return dlsym(handle, name);
+}
+
 // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
 // load symbol from base version instead.
 void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
-  void *f = dlvsym(handle, name, "libnuma_1.1");
-  if (f == NULL) {
-    f = dlsym(handle, name);
-  }
-  return f;
+  return dlvsym_if_available(handle, name, "libnuma_1.1");
 }
 
 // Handle request to load libnuma symbol version 1.2 (API v2) only.
 // Return NULL if the symbol is not defined in this particular version.
 void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
-  return dlvsym(handle, name, "libnuma_1.2");
+  return dlvsym_if_available(handle, name, "libnuma_1.2");
 }
 
 bool os::Linux::libnuma_init() {
@@ -4877,6 +4896,63 @@
 extern void report_error(char* file_name, int line_no, char* title,
                          char* format, ...);
 
+// Some linux distributions (notably: Alpine Linux) include the
+// grsecurity in the kernel by default. Of particular interest from a
+// JVM perspective is PaX (https://pax.grsecurity.net/), which adds
+// some security features related to page attributes. Specifically,
+// the MPROTECT PaX functionality
+// (https://pax.grsecurity.net/docs/mprotect.txt) prevents dynamic
+// code generation by disallowing a (previously) writable page to be
+// marked as executable. This is, of course, exactly what HotSpot does
+// for both JIT compiled method, as well as for stubs, adapters, etc.
+//
+// Instead of crashing "lazily" when trying to make a page executable,
+// this code probes for the presence of PaX and reports the failure
+// eagerly.
+static void check_pax(void) {
+  // Zero doesn't generate code dynamically, so no need to perform the PaX check
+#ifndef ZERO
+  size_t size = os::Linux::page_size();
+
+  void* p = ::mmap(NULL, size, PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+  if (p == MAP_FAILED) {
+    vm_exit_out_of_memory(size, OOM_MMAP_ERROR, "failed to allocate memory for PaX check.");
+  }
+
+  int res = ::mprotect(p, size, PROT_WRITE|PROT_EXEC);
+  if (res == -1) {
+    vm_exit_during_initialization("Failed to mark memory page as executable",
+                                  "Please check if grsecurity/PaX is enabled in your kernel.\n"
+                                  "\n"
+                                  "For example, you can do this by running (note: you may need root privileges):\n"
+                                  "\n"
+                                  "    sysctl kernel.pax.softmode\n"
+                                  "\n"
+                                  "If PaX is included in the kernel you will see something like this:\n"
+                                  "\n"
+                                  "    kernel.pax.softmode = 0\n"
+                                  "\n"
+                                  "In particular, if the value is 0 (zero), then PaX is enabled.\n"
+                                  "\n"
+                                  "PaX includes security functionality which interferes with the dynamic code\n"
+                                  "generation the JVM relies on. Specifically, the MPROTECT functionality as\n"
+                                  "described on https://pax.grsecurity.net/docs/mprotect.txt is not compatible\n"
+                                  "with the JVM. If you want to allow the JVM to run you will have to disable PaX.\n"
+                                  "You can do this on a per-executable basis using the paxctl tool, for example:\n"
+                                  "\n"
+                                  "    paxctl -cm bin/java\n"
+                                  "\n"
+                                  "Please note that this modifies the executable binary in-place, so you may want\n"
+                                  "to make a backup of it first. Also note that you have to repeat this for other\n"
+                                  "executables like javac, jar, jcmd, etc.\n"
+                                  );
+
+  }
+
+  ::munmap(p, size);
+#endif
+}
+
 // this is called _before_ most of the global arguments have been parsed
 void os::init(void) {
   char dummy;   // used to get a guess on initial stack address
@@ -4906,6 +4982,8 @@
   Linux::_pthread_setname_np =
     (int(*)(pthread_t, const char*))dlsym(RTLD_DEFAULT, "pthread_setname_np");
 
+  check_pax();
+
   os::Posix::init();
 }
 
--- a/src/hotspot/share/runtime/vm_version.cpp	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/hotspot/share/runtime/vm_version.cpp	Fri Mar 16 15:59:12 2018 -0700
@@ -263,8 +263,14 @@
     #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   #endif
 
+  #ifdef HOTSPOT_LIBC
+    #define LIBC_STR "-" HOTSPOT_LIBC
+  #else
+    #define LIBC_STR ""
+  #endif
+
   #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
-         " for " OS "-" CPU FLOAT_ARCH_STR \
+         " for " OS "-" CPU FLOAT_ARCH_STR LIBC_STR \
          " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
 
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Fri Mar 16 15:59:12 2018 -0700
@@ -204,7 +204,7 @@
 #elif defined(__APPLE__)
 inline int g_isnan(double f) { return isnan(f); }
 #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
-inline int g_isnan(float  f) { return isnanf(f); }
+inline int g_isnan(float  f) { return isnan(f); }
 inline int g_isnan(double f) { return isnan(f); }
 #else
 #error "missing platform-specific definition here"
--- a/src/java.base/linux/native/libnet/linux_close.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/java.base/linux/native/libnet/linux_close.c	Fri Mar 16 15:59:12 2018 -0700
@@ -60,7 +60,7 @@
 /*
  * Signal to unblock thread
  */
-static int sigWakeup = (__SIGRTMAX - 2);
+static int sigWakeup;
 
 /*
  * fdTable holds one entry per file descriptor, up to a certain
@@ -149,6 +149,7 @@
     /*
      * Setup the signal handler
      */
+    sigWakeup = SIGRTMAX - 2;
     sa.sa_handler = sig_wakeup;
     sa.sa_flags   = 0;
     sigemptyset(&sa.sa_mask);
--- a/src/java.base/unix/native/libjava/jdk_util_md.h	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/java.base/unix/native/libjava/jdk_util_md.h	Fri Mar 16 15:59:12 2018 -0700
@@ -37,7 +37,7 @@
 #define ISNAND(d) isnan(d)
 #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
 #include <math.h>
-#define ISNANF(f) isnanf(f)
+#define ISNANF(f) isnan(f)
 #define ISNAND(d) isnan(d)
 #elif defined(_AIX)
 #include <math.h>
--- a/src/java.base/unix/native/libjli/java_md_solinux.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/java.base/unix/native/libjli/java_md_solinux.c	Fri Mar 16 15:59:12 2018 -0700
@@ -235,6 +235,39 @@
     char *dmllp = NULL;
     char *p; /* a utility pointer */
 
+#ifdef __linux
+#ifndef LIBC
+#error "LIBC not set"
+#endif
+
+    if (strcmp(LIBC, "musl") == 0) {
+      /*
+       * The musl library loader requires LD_LIBRARY_PATH to be set in
+       * order to correctly resolve the dependency libjava.so has on libjvm.so.
+       *
+       * Specifically, it differs from glibc in the sense that even if
+       * libjvm.so has already been loaded it will not be considered a
+       * candidate for resolving the dependency unless the *full* path
+       * of the already loaded library matches the dependency being loaded.
+       *
+       * libjvm.so is being loaded by the launcher using a long path to
+       * dlopen, not just the basename of the library. Typically this
+       * is something like "../lib/server/libjvm.so". However, if/when
+       * libjvm.so later tries to dlopen libjava.so (which it does in
+       * order to get access to a few functions implemented in
+       * libjava.so) the musl loader will, as part of loading
+       * dependent libraries, try to load libjvm.so using only its
+       * basename "libjvm.so". Since this does not match the longer
+       * path path it was first loaded with, the already loaded
+       * library is not considered a candidate, and the loader will
+       * instead look for libjvm.so elsewhere. If it's not in
+       * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
+       * will therefore fail as well.
+       */
+      return JNI_TRUE;
+    }
+#endif
+
 #ifdef AIX
     /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
     return JNI_TRUE;
--- a/src/java.base/unix/native/libnio/ch/NativeThread.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/java.base/unix/native/libnio/ch/NativeThread.c	Fri Mar 16 15:59:12 2018 -0700
@@ -36,7 +36,7 @@
 #ifdef __linux__
   #include <pthread.h>
   /* Also defined in net/linux_close.c */
-  #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+  #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
 #elif _AIX
   #include <pthread.h>
   /* Also defined in net/aix_close.c */
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Fri Mar 16 15:59:12 2018 -0700
@@ -27,9 +27,6 @@
 #include <X11/Xutil.h>
 #include <X11/Xos.h>
 #include <X11/Xatom.h>
-#ifdef __linux__
-#include <execinfo.h>
-#endif
 
 #include <jvm.h>
 #include <jni.h>
@@ -787,26 +784,6 @@
     return ret;
 }
 
-#ifdef __linux__
-void print_stack(void)
-{
-  void *array[10];
-  size_t size;
-  char **strings;
-  size_t i;
-
-  size = backtrace (array, 10);
-  strings = backtrace_symbols (array, size);
-
-  fprintf (stderr, "Obtained %zd stack frames.\n", size);
-
-  for (i = 0; i < size; i++)
-     fprintf (stderr, "%s\n", strings[i]);
-
-  free (strings);
-}
-#endif
-
 Window get_xawt_root_shell(JNIEnv *env) {
   static jclass classXRootWindow = NULL;
   static jmethodID methodGetXRootWindow = NULL;
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.c	Fri Mar 16 15:59:12 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 
 #include <jni.h>
 #include "libproc.h"
+#include "libproc_impl.h"
 
 #include <elf.h>
 #include <sys/types.h>
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c	Fri Mar 16 15:59:12 2018 -0700
@@ -26,7 +26,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
+#ifdef INCLUDE_SA_ATTACH
 #include <thread_db.h>
+#else
+#include <dirent.h>
+#endif
 #include "libproc_impl.h"
 
 #define SA_ALTROOT "SA_ALTROOT"
@@ -116,11 +120,13 @@
    // init debug mode
    _libsaproc_debug = debug;
 
+#ifdef INCLUDE_SA_ATTACH
    // initialize the thread_db library
    if (td_init() != TD_OK) {
      print_debug("libthread_db's td_init failed\n");
      return false;
    }
+#endif
 
    return true;
 }
@@ -273,6 +279,7 @@
 }
 
 
+#ifdef INCLUDE_SA_ATTACH
 // struct used for client data from thread_db callback
 struct thread_db_client_data {
    struct ps_prochandle* ph;
@@ -299,9 +306,12 @@
 
   return TD_OK;
 }
+#endif // INCLUDE_SA_ATTACH
 
-// read thread_info using libthread_db
+// read thread_info using libthread_db or by iterating through the entries
+// in /proc/<pid>/task/
 bool read_thread_info(struct ps_prochandle* ph, thread_info_callback cb) {
+#ifdef INCLUDE_SA_ATTACH
   struct thread_db_client_data mydata;
   td_thragent_t* thread_agent = NULL;
   if (td_ta_new(ph, &thread_agent) != TD_OK) {
@@ -322,10 +332,33 @@
 
   // delete thread agent
   td_ta_delete(thread_agent);
+#else
+  DIR *dir = NULL;
+  struct dirent *ent = NULL;
+  char taskpath[80];
+  pid_t pid = ph->pid;
+
+  // Find the lwpids to attach to by traversing the /proc/<pid>/task/ directory.
+  snprintf(taskpath, sizeof (taskpath), "/proc/%ld/task", (unsigned long)pid);
+  if ((dir = opendir(taskpath)) != NULL) {
+    while ((ent = readdir(dir)) != NULL) {
+      unsigned long lwp;
+
+      if ((lwp = strtoul(ent->d_name, NULL, 10)) != 0) {
+        // Create and add the thread info.
+        (*cb)(ph, 0, lwp);
+      }
+    }
+  } else {
+    print_debug("Could not open /proc/%ld/task.\n", (unsigned long)pid);
+    return false;
+  }
+
+  closedir(dir);
+#endif
   return true;
 }
 
-
 // get number of threads
 int get_num_threads(struct ps_prochandle* ph) {
    return ph->num_threads;
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.h	Fri Mar 16 15:59:12 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,9 @@
 
 #include <unistd.h>
 #include <limits.h>
+
+struct ps_prochandle;
+
 #include "libproc.h"
 #include "symtab.h"
 
@@ -126,4 +129,32 @@
 // a test for ELF signature without using libelf
 bool is_elf_file(int fd);
 
+// ps_getpid() is only defined on Linux to return a thread's process ID
+pid_t ps_getpid(struct ps_prochandle *ph);
+
+// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
+// of the load object object_name in the target process identified by ph.
+// It returns the symbol's value as an address in the target process in
+// *sym_addr.
+
+ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
+                    const char *sym_name, psaddr_t *sym_addr);
+// read "size" bytes of data from debuggee at address "addr"
+ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t  addr,
+                   void *buf, size_t size);
+
+// write "size" bytes of data to debuggee at address "addr"
+ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
+                    const void *buf, size_t size);
+
+ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);
+
+ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);
+
+ps_err_e  ps_lgetfpregs(struct  ps_prochandle  *ph,  lwpid_t lid, prfpregset_t *fpregs);
+
+ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);
+
+// new libthread_db of NPTL seem to require this symbol
+ps_err_e ps_get_thread_area();
 #endif //_LIBPROC_IMPL_H_
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/proc_service.h	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/proc_service.h	Fri Mar 16 15:59:12 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,10 @@
 #define _PROC_SERVICE_H_
 
 #include <stdio.h>
+#include <sys/procfs.h>
+#ifdef INCLUDE_SA_ATTACH
 #include <thread_db.h>
+#endif
 
 // Linux does not have the proc service library, though it does provide the
 // thread_db library which can be used to manipulate threads without having
@@ -42,35 +45,4 @@
         PS_NOSYM,       /* p_lookup() could not find given symbol */
         PS_NOFREGS      /* FPU register set not available for given lwp */
 } ps_err_e;
-
-// ps_getpid() is only defined on Linux to return a thread's process ID
-pid_t ps_getpid(struct ps_prochandle *ph);
-
-// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
-// of the load object object_name in the target process identified by ph.
-// It returns the symbol's value as an address in the target process in
-// *sym_addr.
-
-ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
-                    const char *sym_name, psaddr_t *sym_addr);
-
-// read "size" bytes of data from debuggee at address "addr"
-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t  addr,
-                   void *buf, size_t size);
-
-// write "size" bytes of data to debuggee at address "addr"
-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
-                    const void *buf, size_t size);
-
-ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);
-
-ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);
-
-ps_err_e  ps_lgetfpregs(struct  ps_prochandle  *ph,  lwpid_t lid, prfpregset_t *fpregs);
-
-ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);
-
-// new libthread_db of NPTL seem to require this symbol
-ps_err_e ps_get_thread_area();
-
 #endif /* _PROC_SERVICE_H_ */
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Fri Mar 16 15:59:12 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -731,6 +731,10 @@
   ELF_PHDR* phbuf;
   ELF_PHDR* lib_php = NULL;
 
+#ifndef LIBC
+#error "LIBC not set"
+#endif
+
   int page_size = sysconf(_SC_PAGE_SIZE);
 
   if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) {
@@ -754,8 +758,8 @@
       } else {
         // Coredump stores value of p_memsz elf field
         // rounded up to page boundary.
-
-        if ((existing_map->memsz != page_size) &&
+        if ((strcmp(LIBC, "musl")) &&
+            (existing_map->memsz != page_size) &&
             (existing_map->fd != lib_fd) &&
             (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) {
 
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c	Fri Mar 16 15:59:12 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,9 +218,11 @@
 static bool ptrace_attach(pid_t pid, char* err_buf, size_t err_buf_len) {
   if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) {
     char buf[200];
-    char* msg = strerror_r(errno, buf, sizeof(buf));
-    snprintf(err_buf, err_buf_len, "ptrace(PTRACE_ATTACH, ..) failed for %d: %s", pid, msg);
-    print_debug("%s\n", err_buf);
+    if (strerror_r(errno, buf, sizeof(buf) == 0)) {
+      snprintf(err_buf, err_buf_len,
+               "ptrace(PTRACE_ATTACH, ..) failed for %d: %s", pid, buf);
+      print_debug("%s\n", err_buf);
+    }
     return false;
   } else {
     return ptrace_waitpid(pid);
@@ -406,7 +408,7 @@
   thr = ph->threads;
   while (thr) {
      // don't attach to the main thread again
-    if (ph->pid != thr->lwp_id && ptrace_attach(thr->lwp_id, err_buf, err_buf_len) != true) {
+     if (pid != thr->lwp_id && ptrace_attach(thr->lwp_id, err_buf, err_buf_len) != true) {
         // even if one attach fails, we get return NULL
         Prelease(ph);
         return NULL;
--- a/src/jdk.jdwp.agent/share/native/libjdwp/util.h	Fri Mar 16 03:17:12 2018 -0700
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/util.h	Fri Mar 16 15:59:12 2018 -0700
@@ -35,15 +35,15 @@
 #ifdef DEBUG
     /* Just to make sure these interfaces are not used here. */
     #undef free
-    #define free(p) Do not use this interface.
+    #define free do_not_use_this_interface_free
     #undef malloc
-    #define malloc(p) Do not use this interface.
+    #define malloc do_not_use_this_interface_malloc
     #undef calloc
-    #define calloc(p) Do not use this interface.
+    #define calloc do_not_use_this_interface_calloc
     #undef realloc
-    #define realloc(p) Do not use this interface.
+    #define realloc do_not_use_this_interface_realloc
     #undef strdup
-    #define strdup(p) Do not use this interface.
+    #define strdup do_not_use_this_interface_strdup
 #endif
 
 #include "log_messages.h"