Fix build on rhES5
authorTom Tromey <tromey@adacore.com>
Wed, 12 May 2021 18:39:22 +0000 (12:39 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 9 Nov 2021 21:21:39 +0000 (14:21 -0700)
The rhES5 build failed due to an upstream import a while back.  The
bug here is that, while the 'personality' function exists,
ADDR_NO_RANDOMIZE is only defined in <linux/personality.h>, not
<sys/personality.h>.

However, <linux/personality.h> does not declare the 'personality'
function, and <sys/personality.h> and <linux/personality.h> cannot
both be included.

This patch restores one of the removed configure checks and updates
the code to check it.

We had this as a local patch at AdaCore, because it seemed like there
was no interest upstream.  However, now it turns out that this fixes
PR build/28555, so I'm sending it now.

gdb/config.in
gdb/configure
gdb/nat/linux-personality.c
gdbserver/config.in
gdbserver/configure
gdbsupport/common.m4
gdbsupport/config.in
gdbsupport/configure

index 2c30504905b8674fa1468b645ec76df7fe75b230..776bee91a036cbd16d1a2f2066ebb3140f693b39 100644 (file)
 /* define if the compiler supports basic C++11 syntax */
 #undef HAVE_CXX11
 
+/* Define to 1 if you have the declaration of `ADDR_NO_RANDOMIZE', and to 0 if
+   you don't. */
+#undef HAVE_DECL_ADDR_NO_RANDOMIZE
+
 /* Define to 1 if you have the declaration of `asprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_ASPRINTF
index 6d4c2b17ed2ef4f411e1d838b1236b7710dfcd27..c248dca5fac51fb5ca317b501603b8d48c86b757 100755 (executable)
 done
 
 
+  # This is needed for RHEL 5 and uclibc-ng < 1.0.39.
+  # These did not define ADDR_NO_RANDOMIZE in sys/personality.h,
+  # only in linux/personality.h.
+  ac_fn_c_check_decl "$LINENO" "ADDR_NO_RANDOMIZE" "ac_cv_have_decl_ADDR_NO_RANDOMIZE" "#include <sys/personality.h>
+"
+if test "x$ac_cv_have_decl_ADDR_NO_RANDOMIZE" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ADDR_NO_RANDOMIZE $ac_have_decl
+_ACEOF
+
+
   ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strstr" = xyes; then :
   ac_have_decl=1
index 9ce345bc6de2a8c4a8fff4e1615f773bc8c51cad..27999fd19df6a67c27c4736ff95136db86d54266 100644 (file)
 
 #include <sys/personality.h>
 
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#  define ADDR_NO_RANDOMIZE 0x0040000
+# endif /* ! HAVE_DECL_ADDR_NO_RANDOMIZE */
+
 /* See comment on nat/linux-personality.h.  */
 
 maybe_disable_address_space_randomization::
index cf06c56421d1147ee3b073a4c8c7e2ef755708ae..c9258b326b5d2664eecef2fbce92252e40ad491f 100644 (file)
 /* define if the compiler supports basic C++11 syntax */
 #undef HAVE_CXX11
 
+/* Define to 1 if you have the declaration of `ADDR_NO_RANDOMIZE', and to 0 if
+   you don't. */
+#undef HAVE_DECL_ADDR_NO_RANDOMIZE
+
 /* Define to 1 if you have the declaration of `asprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_ASPRINTF
index f05c1a9b9761e47144b37150ef38eebcbebdf642..fbde90394e098bec47c0063f773e2458b569f4ea 100755 (executable)
@@ -7139,6 +7139,22 @@ fi
 done
 
 
+  # This is needed for RHEL 5 and uclibc-ng < 1.0.39.
+  # These did not define ADDR_NO_RANDOMIZE in sys/personality.h,
+  # only in linux/personality.h.
+  ac_fn_c_check_decl "$LINENO" "ADDR_NO_RANDOMIZE" "ac_cv_have_decl_ADDR_NO_RANDOMIZE" "#include <sys/personality.h>
+"
+if test "x$ac_cv_have_decl_ADDR_NO_RANDOMIZE" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ADDR_NO_RANDOMIZE $ac_have_decl
+_ACEOF
+
+
   ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strstr" = xyes; then :
   ac_have_decl=1
index 901c454ea8cbbb9c3ecf7aa8ff2978d70738cbc3..56a355e85b1ac2705c247de0fc4552c6b131c3fb 100644 (file)
@@ -55,6 +55,11 @@ AC_DEFUN([GDB_AC_COMMON], [
                  ptrace64 sbrk setns sigaltstack sigprocmask \
                  setpgid setpgrp getrusage getauxval sigtimedwait])
 
+  # This is needed for RHEL 5 and uclibc-ng < 1.0.39.
+  # These did not define ADDR_NO_RANDOMIZE in sys/personality.h,
+  # only in linux/personality.h.
+  AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
+
   AC_CHECK_DECLS([strstr])
 
   # ----------------------- #
index f46e2612c7433c27c36110c6722900878695ca49..6945a627ffe13970402f22be683e1e713159b7c3 100644 (file)
 /* define if the compiler supports basic C++11 syntax */
 #undef HAVE_CXX11
 
+/* Define to 1 if you have the declaration of `ADDR_NO_RANDOMIZE', and to 0 if
+   you don't. */
+#undef HAVE_DECL_ADDR_NO_RANDOMIZE
+
 /* Define to 1 if you have the declaration of `asprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_ASPRINTF
index ae6047865ae7645fb90ca0ba1a6d432240d85ded..aad746946e55242ff1dd1dbf109af7902f4cda65 100755 (executable)
@@ -8152,6 +8152,22 @@ fi
 done
 
 
+  # This is needed for RHEL 5 and uclibc-ng < 1.0.39.
+  # These did not define ADDR_NO_RANDOMIZE in sys/personality.h,
+  # only in linux/personality.h.
+  ac_fn_c_check_decl "$LINENO" "ADDR_NO_RANDOMIZE" "ac_cv_have_decl_ADDR_NO_RANDOMIZE" "#include <sys/personality.h>
+"
+if test "x$ac_cv_have_decl_ADDR_NO_RANDOMIZE" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ADDR_NO_RANDOMIZE $ac_have_decl
+_ACEOF
+
+
   ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strstr" = xyes; then :
   ac_have_decl=1
This page took 0.037265 seconds and 4 git commands to generate.