Disable PIE in MacOS X Lion, thus pdump works again...
authorNelson Ferreira <nelson.ferreira@ieee.org>
Thu, 1 Dec 2011 17:37:29 +0000 (12:37 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Thu, 1 Dec 2011 17:37:29 +0000 (12:37 -0500)
* configure.ac: If darwin linker supports -no_pie, add it
* m4/sxe-bldenv.m4 (SXE_LD_NO_PIE): New function to check if the
linker supports -no_pie.
* m4/sxe-compiler.m4 (SXE_CHECK_CC_CHAR): Invoke the linker check for -no_pie

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
configure.ac
m4/sxe-bldenv.m4
m4/sxe-compiler.m4

index 53965e9..1ecc2aa 100644 (file)
@@ -990,8 +990,11 @@ if test "$with_dynamic" = "yes"; then
        decosf* )
                ld_call_shared="-call_shared"
                ;;
-       darwin )
+       darwin* )
                AC_DEFINE([DLSYM_NEEDS_UNDERSCORE], [1], [Description here!])
+               if test "x$have_ld_no_pie" != "x"; then
+                       SXE_PREPEND_LINKER_FLAG([-no_pie], [ld_switch_site])
+               fi
                ;;
        esac
 else dnl "$with_dynamic" = "no"
@@ -1007,6 +1010,12 @@ else dnl "$with_dynamic" = "no"
        decosf* )
                ld_call_shared="-non_shared"
                ;;
+       darwin* )
+               AC_DEFINE([DLSYM_NEEDS_UNDERSCORE], [1], [Description here!])
+               if test "x$have_ld_no_pie" != "x"; then
+                       SXE_PREPEND_LINKER_FLAG([-no_pie], [ld_switch_site])
+               fi
+               ;;
        esac
 fi
 
index 64d66b3..13a78ae 100644 (file)
@@ -15,6 +15,22 @@ return 0;
        SXE_RESTORE_LIBS
 ])dnl SXE_LD_EXPORT_DYNAMIC
 
+
+AC_DEFUN([SXE_LD_NO_PIE], [dnl
+       AC_MSG_CHECKING([if linker understands -no_pie])
+       SXE_DUMP_LIBS
+       LDFLAGS="-no_pie $LDFLAGS"
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <stdlib.h>
+]],[[
+return 0;
+]])],  [AC_MSG_RESULT([yes])
+        have_ld_no_pie="yes"], [
+       AC_MSG_RESULT([no])
+       have_ld_no_pie="no"])
+       SXE_RESTORE_LIBS
+])dnl SXE_LD_NO_PIE
+
 dnl SXE_RILLY_COMPUTE_LD_RUN_PATH()
 AC_DEFUN([SXE_RILLY_COMPUTE_LD_RUN_PATH], [dnl
        if test "$add_runtime_path" = "yes" -a -n "$dash_r"; then
index b5e6aa3..c42974a 100644 (file)
@@ -323,6 +323,8 @@ typedef __gnuc_va_list va_list;]],[[1]])], [dnl
 
        dnl in case we need the modules
        SXE_LD_EXPORT_DYNAMIC
+       dnl in case compiler issues PIE by default which breaks pdump
+       SXE_LD_NO_PIE
 
        ## check whether CC reacts to `extern inline' gnu89 inline declarations
        ## with a warning