diff options
author | Tom Tromey <tromey@adacore.com> | 2021-05-12 12:39:22 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-11-09 08:21:18 -0700 |
commit | 0b03c6f03d51f441d999e0cee92f81af543d9373 (patch) | |
tree | f23e058934e5ab2f3da8a79c47ce66bd65c3aea2 /gdb | |
parent | 469ca94170aa4f14cc3b3dc9e7d8c02bb17f8c91 (diff) | |
download | gdb-0b03c6f03d51f441d999e0cee92f81af543d9373.zip gdb-0b03c6f03d51f441d999e0cee92f81af543d9373.tar.gz gdb-0b03c6f03d51f441d999e0cee92f81af543d9373.tar.bz2 |
Fix build on rhES5
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/config.in | 4 | ||||
-rwxr-xr-x | gdb/configure | 16 | ||||
-rw-r--r-- | gdb/nat/linux-personality.c | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/gdb/config.in b/gdb/config.in index c61f7a9..773a0ba 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -96,6 +96,10 @@ /* 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 diff --git a/gdb/configure b/gdb/configure index d5c1883..6e2dfb7 100755 --- a/gdb/configure +++ b/gdb/configure @@ -13863,6 +13863,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 diff --git a/gdb/nat/linux-personality.c b/gdb/nat/linux-personality.c index 9ce345b..27999fd 100644 --- a/gdb/nat/linux-personality.c +++ b/gdb/nat/linux-personality.c @@ -22,6 +22,10 @@ #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:: |