changeset 1885:2865d0fe7bad

Add check to see if ld requires -z wxneeded on OpenBSD.
author kurt
date Sat, 10 Dec 2016 13:49:49 -0500
parents 8a4be4547074
children cd58dee19e65
files common/autoconf/toolchain.m4
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/toolchain.m4	Mon Oct 24 19:45:12 2016 -0700
+++ b/common/autoconf/toolchain.m4	Sat Dec 10 13:49:49 2016 -0500
@@ -1099,6 +1099,22 @@
   fi
   if test "x$OPENJDK_TARGET_OS" = xbsd; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"
+    if test "`uname -s`" = "OpenBSD"; then
+        AC_MSG_CHECKING([if ld requires -z wxneeded])
+        AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/mman.h>
+int main() { return mmap(0, 4096, PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) != MAP_FAILED; }]])],
+            [
+              AC_MSG_RESULT([yes])
+              LDFLAGS_JDK="$LDFLAGS_JDK -Wl,-z,wxneeded"
+            ],
+            [
+              AC_MSG_RESULT([no])
+            ],
+            [
+              AC_MSG_RESULT([no])
+            ]
+        )
+    fi
   fi
   if test "x$DEBUG_LEVEL" = xrelease; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DNDEBUG"