public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix compiler warnings building against Linux uapi headers
@ 2015-06-22 19:09 enh
  2015-06-26 15:42 ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: enh @ 2015-06-22 19:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Doug Evans

building gdb against the Linux kernel's uapi headers (as used by
Android's bionic C library) causes warnings such as:

gdb/gdbserver/linux-arm-low.c:122:0: warning: "HWCAP_VFP" redefined
[enabled by default]

because linux-arm-low.c has #defines like this:

 #define HWCAP_VFP       64

but the current Linux kernel #define looks like this instead:

 #define HWCAP_VFP (1 << 6)

I don't know whether you still need to support versions of glibc that
don't have these constants at all; if you don't, a better fix would be
to remove gdbserver's duplicate definitions. But on the assumption
that you do need to support old versions of glibc, here's a patch to
avoid the redefinition...

2015-06-22  Elliott Hughes  <enh@google.com>

	* linux-arm-low.c: Only define HWCAP_VFP and friends if they're
	not already defined. Fixes build against Linux uapi headers.

diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 303d9c8..f199b1c 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -119,11 +119,21 @@ struct arch_lwp_info
 static unsigned long arm_hwcap;

 /* These are in <asm/elf.h> in current kernels.  */
+#ifndef HWCAP_VFP
 #define HWCAP_VFP       64
+#endif
+#ifndef HWCAP_IWMMXT
 #define HWCAP_IWMMXT    512
+#endif
+#ifndef HWCAP_NEON
 #define HWCAP_NEON      4096
+#endif
+#ifndef HWCAP_VFPv3
 #define HWCAP_VFPv3     8192
+#endif
+#ifndef HWCAP_VFPv3D16
 #define HWCAP_VFPv3D16  16384
+#endif

 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>

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

* Re: [PATCH] Fix compiler warnings building against Linux uapi headers
  2015-06-22 19:09 [PATCH] Fix compiler warnings building against Linux uapi headers enh
@ 2015-06-26 15:42 ` Yao Qi
  2015-08-05  8:50   ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2015-06-26 15:42 UTC (permalink / raw)
  To: enh; +Cc: gdb-patches, Doug Evans

enh <enh@google.com> writes:

> to remove gdbserver's duplicate definitions. But on the assumption
> that you do need to support old versions of glibc, here's a patch to
> avoid the redefinition...

We should avoid the redefinition in gdb/arm-linux-tdep.h too.  Could you
please fix it there too?

>
> 2015-06-22  Elliott Hughes  <enh@google.com>
>
> 	* linux-arm-low.c: Only define HWCAP_VFP and friends if they're
> 	not already defined. Fixes build against Linux uapi headers.

OK with the changes.

-- 
Yao (齐尧)

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

* Re: [PATCH] Fix compiler warnings building against Linux uapi headers
  2015-06-26 15:42 ` Yao Qi
@ 2015-08-05  8:50   ` Mike Frysinger
  2015-08-25 20:34     ` enh
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2015-08-05  8:50 UTC (permalink / raw)
  To: Yao Qi; +Cc: enh, gdb-patches, Doug Evans

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

On 26 Jun 2015 16:42, Yao Qi wrote:
> enh <enh@google.com> writes:
> > to remove gdbserver's duplicate definitions. But on the assumption
> > that you do need to support old versions of glibc, here's a patch to
> > avoid the redefinition...
> 
> We should avoid the redefinition in gdb/arm-linux-tdep.h too.  Could you
> please fix it there too?
> 
> > 2015-06-22  Elliott Hughes  <enh@google.com>
> >
> > 	* linux-arm-low.c: Only define HWCAP_VFP and friends if they're
> > 	not already defined. Fixes build against Linux uapi headers.
> 
> OK with the changes.

Elliott: you going to respin this ?
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] Fix compiler warnings building against Linux uapi headers
  2015-08-05  8:50   ` Mike Frysinger
@ 2015-08-25 20:34     ` enh
  2015-08-26 11:25       ` Yao Qi
  0 siblings, 1 reply; 6+ messages in thread
From: enh @ 2015-08-25 20:34 UTC (permalink / raw)
  To: Yao Qi, enh, gdb-patches, Doug Evans

sorry; been too busy to get back to this. new patch addresses earlier comment:

2015-08-25  Elliott Hughes  <enh@google.com>

        * arm-linux-tdep.h, linux-arm-low.c: Only define HWCAP_VFP and
        friends if they're not already defined. Fixes build against Linux
        uapi headers.

diff --git a/gdb/arm-linux-tdep.h b/gdb/arm-linux-tdep.h
index dc05edf..d6a1181 100644
--- a/gdb/arm-linux-tdep.h
+++ b/gdb/arm-linux-tdep.h
@@ -61,9 +61,19 @@ void arm_linux_collect_nwfpe (const struct regset *regset,

 /* ARM GNU/Linux HWCAP values.  These are in defined in
    <asm/elf.h> in current kernels.  */
+#ifndef HWCAP_VFP
 #define HWCAP_VFP       64
+#endif
+#ifndef HWCAP_IWMMXT
 #define HWCAP_IWMMXT    512
+#endif
+#ifndef HWCAP_NEON
 #define HWCAP_NEON      4096
+#endif
+#ifndef HWCAP_VFPv3
 #define HWCAP_VFPv3     8192
+#endif
+#ifndef HWCAP_VFPv3D16
 #define HWCAP_VFPv3D16  16384
+#endif

diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index 6a27e6e..60645de 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -117,11 +117,21 @@ struct arch_lwp_info
 };

 /* These are in <asm/elf.h> in current kernels.  */
+#ifndef HWCAP_VFP
 #define HWCAP_VFP       64
+#endif
+#ifndef HWCAP_IWMMXT
 #define HWCAP_IWMMXT    512
+#endif
+#ifndef HWCAP_NEON
 #define HWCAP_NEON      4096
+#endif
+#ifndef HWCAP_VFPv3
 #define HWCAP_VFPv3     8192
+#endif
+#ifndef HWCAP_VFPv3D16
 #define HWCAP_VFPv3D16  16384
+#endif

 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>



On 8/5/15, Mike Frysinger <vapier@gentoo.org> wrote:
> On 26 Jun 2015 16:42, Yao Qi wrote:
>> enh <enh@google.com> writes:
>> > to remove gdbserver's duplicate definitions. But on the assumption
>> > that you do need to support old versions of glibc, here's a patch to
>> > avoid the redefinition...
>>
>> We should avoid the redefinition in gdb/arm-linux-tdep.h too.  Could you
>> please fix it there too?
>>
>> > 2015-06-22  Elliott Hughes  <enh@google.com>
>> >
>> > 	* linux-arm-low.c: Only define HWCAP_VFP and friends if they're
>> > 	not already defined. Fixes build against Linux uapi headers.
>>
>> OK with the changes.
>
> Elliott: you going to respin this ?
> -mike
>


-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.

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

* Re: [PATCH] Fix compiler warnings building against Linux uapi headers
  2015-08-25 20:34     ` enh
@ 2015-08-26 11:25       ` Yao Qi
  2015-08-26 15:25         ` enh
  0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2015-08-26 11:25 UTC (permalink / raw)
  To: enh; +Cc: Yao Qi, gdb-patches, Doug Evans

enh <enh@google.com> writes:

> 2015-08-25  Elliott Hughes  <enh@google.com>
>
>         * arm-linux-tdep.h, linux-arm-low.c: Only define HWCAP_VFP and
>         friends if they're not already defined. Fixes build against Linux
>         uapi headers.

We need two changelog entries for gdb/ChangeLog and
gdb/gdbserver/ChangeLog respectively.  The last sentence "Fixes build
against Linux uapi headers" is not needed.

OK with the changes.

-- 
Yao (齐尧)

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

* Re: [PATCH] Fix compiler warnings building against Linux uapi headers
  2015-08-26 11:25       ` Yao Qi
@ 2015-08-26 15:25         ` enh
  0 siblings, 0 replies; 6+ messages in thread
From: enh @ 2015-08-26 15:25 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, Doug Evans

2015-08-26  Elliott Hughes  <enh@google.com>

        * arm-linux-tdep.h: Only define HWCAP_VFP and friends if they're
        not already defined.

2015-08-26  Elliott Hughes  <enh@google.com>

        * linux-arm-low.c: Only define HWCAP_VFP and friends if they're
        not already defined.



On 8/26/15, Yao Qi <qiyaoltc@gmail.com> wrote:
> enh <enh@google.com> writes:
>
>> 2015-08-25  Elliott Hughes  <enh@google.com>
>>
>>         * arm-linux-tdep.h, linux-arm-low.c: Only define HWCAP_VFP and
>>         friends if they're not already defined. Fixes build against Linux
>>         uapi headers.
>
> We need two changelog entries for gdb/ChangeLog and
> gdb/gdbserver/ChangeLog respectively.  The last sentence "Fixes build
> against Linux uapi headers" is not needed.
>
> OK with the changes.
>
> --
> Yao (齐尧)
>


-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.

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

end of thread, other threads:[~2015-08-26 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-22 19:09 [PATCH] Fix compiler warnings building against Linux uapi headers enh
2015-06-26 15:42 ` Yao Qi
2015-08-05  8:50   ` Mike Frysinger
2015-08-25 20:34     ` enh
2015-08-26 11:25       ` Yao Qi
2015-08-26 15:25         ` enh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).