Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Define DT_MIPS_RLD_MAP if not already defined.
@ 2012-05-30  4:40 Thiago Jung Bauermann
  2012-05-30 18:03 ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Thiago Jung Bauermann @ 2012-05-30  4:40 UTC (permalink / raw)
  To: gdb-patches ml

Hello,

Android doesn't support MIPS, so understandably there's no
DT_MIPS_RLD_MAP in its header files. This patch allows gdbserver to be
compiled for Android.

Maybe it's even an obvious patch...

-- 
[]'s
Thiago Jung Bauermann
Linaro Toolchain Working Group


2012-05-30  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>

	* linux-low.c (DT_MIPS_RLD_MAP): Define if not provided by
	a system header.

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c015a61..c351d74 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -84,6 +84,10 @@
 #endif
 #endif
 
+#ifndef DT_MIPS_RLD_MAP
+#define DT_MIPS_RLD_MAP 0x70000016
+#endif
+
 #ifndef HAVE_ELF32_AUXV_T
 /* Copied from glibc's elf.h.  */
 typedef struct



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] Define DT_MIPS_RLD_MAP if not already defined.
  2012-05-30  4:40 [RFA] Define DT_MIPS_RLD_MAP if not already defined Thiago Jung Bauermann
@ 2012-05-30 18:03 ` Pedro Alves
  2012-05-30 18:36   ` Thiago Jung Bauermann
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2012-05-30 18:03 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: gdb-patches ml

On 05/30/2012 05:40 AM, Thiago Jung Bauermann wrote:
> Hello,
>
> Android doesn't support MIPS, so understandably there's no
> DT_MIPS_RLD_MAP in its header files. This patch allows gdbserver to be
> compiled for Android.

Then why not '#ifdef DT_MIPS_RLD_MAP' out the bits that use DT_MIPS_RLD_MAP ?
It's just dead code on non-MIPS ports.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] Define DT_MIPS_RLD_MAP if not already defined.
  2012-05-30 18:03 ` Pedro Alves
@ 2012-05-30 18:36   ` Thiago Jung Bauermann
  2012-05-30 18:50     ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Thiago Jung Bauermann @ 2012-05-30 18:36 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches ml

On Wed, 2012-05-30 at 19:03 +0100, Pedro Alves wrote:
> On 05/30/2012 05:40 AM, Thiago Jung Bauermann wrote:
> > Hello,
> >
> > Android doesn't support MIPS, so understandably there's no
> > DT_MIPS_RLD_MAP in its header files. This patch allows gdbserver to be
> > compiled for Android.
> 
> Then why not '#ifdef DT_MIPS_RLD_MAP' out the bits that use DT_MIPS_RLD_MAP ?
> It's just dead code on non-MIPS ports.

I thought #ifdef'ing platform-specific code was discouraged in GDB. I
can certainly do that though.

-- 
[]'s
Thiago Jung Bauermann
Linaro Toolchain Working Group


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] Define DT_MIPS_RLD_MAP if not already defined.
  2012-05-30 18:36   ` Thiago Jung Bauermann
@ 2012-05-30 18:50     ` Pedro Alves
  2012-05-30 19:27       ` Thiago Jung Bauermann
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2012-05-30 18:50 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: gdb-patches ml

On 05/30/2012 07:35 PM, Thiago Jung Bauermann wrote:

> On Wed, 2012-05-30 at 19:03 +0100, Pedro Alves wrote:
>> On 05/30/2012 05:40 AM, Thiago Jung Bauermann wrote:
>>> Hello,
>>>
>>> Android doesn't support MIPS, so understandably there's no
>>> DT_MIPS_RLD_MAP in its header files. This patch allows gdbserver to be
>>> compiled for Android.
>>
>> Then why not '#ifdef DT_MIPS_RLD_MAP' out the bits that use DT_MIPS_RLD_MAP ?
>> It's just dead code on non-MIPS ports.
> 
> I thought #ifdef'ing platform-specific code was discouraged in GDB. I
> can certainly do that though.


It is, mostly in common code.  But this is native code.  The alternative
is to abstract it in the linux_target_ops interface, but that's quite
overkill for this.  Plenty of other #ifdefs in linux-low.c.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] Define DT_MIPS_RLD_MAP if not already defined.
  2012-05-30 18:50     ` Pedro Alves
@ 2012-05-30 19:27       ` Thiago Jung Bauermann
  2012-05-30 19:29         ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Thiago Jung Bauermann @ 2012-05-30 19:27 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches ml

On Wed, 2012-05-30 at 19:50 +0100, Pedro Alves wrote:
> On 05/30/2012 07:35 PM, Thiago Jung Bauermann wrote:
> 
> > On Wed, 2012-05-30 at 19:03 +0100, Pedro Alves wrote:
> >> On 05/30/2012 05:40 AM, Thiago Jung Bauermann wrote:
> >>> Hello,
> >>>
> >>> Android doesn't support MIPS, so understandably there's no
> >>> DT_MIPS_RLD_MAP in its header files. This patch allows gdbserver to be
> >>> compiled for Android.
> >>
> >> Then why not '#ifdef DT_MIPS_RLD_MAP' out the bits that use DT_MIPS_RLD_MAP ?
> >> It's just dead code on non-MIPS ports.
> > 
> > I thought #ifdef'ing platform-specific code was discouraged in GDB. I
> > can certainly do that though.
> 
> 
> It is, mostly in common code.  But this is native code.  The alternative
> is to abstract it in the linux_target_ops interface, but that's quite
> overkill for this.  Plenty of other #ifdefs in linux-low.c.

What about this version then?

-- 
[]'s
Thiago Jung Bauermann
Linaro Toolchain Working Group


2012-05-30  Thiago Jung Bauermann  <thiago.bauermann@linaro.org>

	* linux-low.c (get_r_debug): Disable code using DT_MIPS_RLD_MAP
	if the platform doesn't know about it.

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index c015a61..e8667ea 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -5492,6 +5492,7 @@ get_r_debug (const int pid, const int is_elf64)
       if (is_elf64)
 	{
 	  Elf64_Dyn *const dyn = (Elf64_Dyn *) buf;
+#ifdef DT_MIPS_RLD_MAP
 	  union
 	    {
 	      Elf64_Xword map;
@@ -5507,6 +5508,7 @@ get_r_debug (const int pid, const int is_elf64)
 	      else
 		break;
 	    }
+#endif	/* DT_MIPS_RLD_MAP */
 
 	  if (dyn->d_tag == DT_DEBUG && map == -1)
 	    map = dyn->d_un.d_val;
@@ -5517,6 +5519,7 @@ get_r_debug (const int pid, const int is_elf64)
       else
 	{
 	  Elf32_Dyn *const dyn = (Elf32_Dyn *) buf;
+#ifdef DT_MIPS_RLD_MAP
 	  union
 	    {
 	      Elf32_Word map;
@@ -5532,6 +5535,7 @@ get_r_debug (const int pid, const int is_elf64)
 	      else
 		break;
 	    }
+#endif	/* DT_MIPS_RLD_MAP */
 
 	  if (dyn->d_tag == DT_DEBUG && map == -1)
 	    map = dyn->d_un.d_val;



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] Define DT_MIPS_RLD_MAP if not already defined.
  2012-05-30 19:27       ` Thiago Jung Bauermann
@ 2012-05-30 19:29         ` Pedro Alves
  2012-05-30 19:52           ` Thiago Jung Bauermann
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2012-05-30 19:29 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: gdb-patches ml

On 05/30/2012 08:26 PM, Thiago Jung Bauermann wrote:

> What about this version then?


Okay, thanks.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFA] Define DT_MIPS_RLD_MAP if not already defined.
  2012-05-30 19:29         ` Pedro Alves
@ 2012-05-30 19:52           ` Thiago Jung Bauermann
  0 siblings, 0 replies; 7+ messages in thread
From: Thiago Jung Bauermann @ 2012-05-30 19:52 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches ml

On Wed, 2012-05-30 at 20:28 +0100, Pedro Alves wrote:
> On 05/30/2012 08:26 PM, Thiago Jung Bauermann wrote:
> 
> > What about this version then?
> 
> 
> Okay, thanks.

Committed. Thanks!
-- 
[]'s
Thiago Jung Bauermann
Linaro Toolchain Working Group


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-30 19:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30  4:40 [RFA] Define DT_MIPS_RLD_MAP if not already defined Thiago Jung Bauermann
2012-05-30 18:03 ` Pedro Alves
2012-05-30 18:36   ` Thiago Jung Bauermann
2012-05-30 18:50     ` Pedro Alves
2012-05-30 19:27       ` Thiago Jung Bauermann
2012-05-30 19:29         ` Pedro Alves
2012-05-30 19:52           ` Thiago Jung Bauermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox