This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH][commit] Fix regression on RHEL-5 systems (was: Re: [PATCH 2/2] Move code to disable ASR to nat/)
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org (GDB Patches), palves at redhat dot com (Pedro Alves), gbenson at redhat dot com (Gary Benson)
- Date: Fri, 16 Jan 2015 11:47:14 -0500
- Subject: [PATCH][commit] Fix regression on RHEL-5 systems (was: Re: [PATCH 2/2] Move code to disable ASR to nat/)
- Authentication-results: sourceware.org; auth=none
- References: <201501161538 dot t0GFclYf021559 at d03av02 dot boulder dot ibm dot com>
On Friday, January 16 2015, Ulrich Weigand wrote:
> Sergio Durigan Junior wrote:
>
>> This patch moves the shared code present on
>> gdb/linux-nat.c:linux_nat_create_inferior and
>> gdb/gdbserver/linux-low.c:linux_create_inferior to
>> nat/linux-personality.c. This code is responsible for disabling
>> address space randomization based on user setting, and using
>> <sys/personality.h> to do that. I decided to put the prototype of the
>> maybe_disable_address_space_randomization on nat/linux-osdata.h
>> because it seemed the best place to put it.
>
> This breaks building on my RHEL 5 machine:
>
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c: In function 'maybe_disable_address_space_randomization':
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c:80: error: 'ADDR_NO_RANDOMIZE' undeclared (first use in this function)
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c:80: error: (Each undeclared identifier is reported only once
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c:80: error: for each function it appears in.)
Ops. Thanks for letting me know, Ulrich.
> It looks like this is because you replaced:
>> -# if !HAVE_DECL_ADDR_NO_RANDOMIZE
> by:
>> +# ifndef HAVE_DECL_ADDR_NO_RANDOMIZE
>
> but config.h on my machine without ADDR_NO_RANDOMIZE contains:
> #define HAVE_DECL_ADDR_NO_RANDOMIZE 0
I took the liberty to go ahead and push the following patch as obvious.
Please let me know if there is anything else needed.
Thanks,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
commit 4c347be60a1c25f78826fbf86d416a278740145b
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri Jan 16 11:42:28 2015 -0500
Fix nat/linux-personality.c regression on RHEL-5
This commit fixes the regression on RHEL-5 systems introduced by
nat/linux-personality.c's check of HAVE_DECL_ADDR_NO_RANDOMIZE.
RHEL-5 systems define HAVE_DECL_ADDR_NO_RANDOMIZE as zero, so we
cannot use #ifndef; instead this patch uses the "#if !" construction.
The regression was reported by Ulrich Weigand here:
<https://sourceware.org/ml/gdb-patches/2015-01/msg00458.html>
gdb/ChangeLog
2015-01-16 Sergio Durigan Junior <sergiodj@redhat.com>
* nat/linux-personality.c: Replace "#ifndef
HAVE_DECL_ADDR_NO_RANDOMIZE" by "#if
!HAVE_DECL_ADDR_NO_RANDOMIZE", fixing a regression in RHEL-5
systems.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b7ba1b2..b95abdc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-16 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * nat/linux-personality.c: Replace "#ifndef
+ HAVE_DECL_ADDR_NO_RANDOMIZE" by "#if
+ !HAVE_DECL_ADDR_NO_RANDOMIZE", fixing a regression in RHEL-5
+ systems.
+
2015-01-16 Eli Zaretskii <eliz@gnu.org>
* tui/tui-win.c (tui_rehighlight_all, tui_set_var_cmd): New
diff --git a/gdb/nat/linux-personality.c b/gdb/nat/linux-personality.c
index f61a2c6..3ea8755 100644
--- a/gdb/nat/linux-personality.c
+++ b/gdb/nat/linux-personality.c
@@ -22,7 +22,7 @@
#ifdef HAVE_PERSONALITY
# include <sys/personality.h>
-# ifndef HAVE_DECL_ADDR_NO_RANDOMIZE
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
# define ADDR_NO_RANDOMIZE 0x0040000
# endif /* ! HAVE_DECL_ADDR_NO_RANDOMIZE */
#endif /* HAVE_PERSONALITY */