[commit] Fix regression on RHEL-5 systems (was: Re: [PATCH 2/2] Move code to disable ASR to nat/)

Message ID 871tmu8ygd.fsf@redhat.com
State New, archived
Headers

Commit Message

Sergio Durigan Junior Jan. 16, 2015, 4:47 p.m. UTC
  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,
  

Patch

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 */