Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: enh <enh@google.com>
To: gdb-patches@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: [PATCH] Fix compiler warnings building against Linux uapi headers
Date: Mon, 22 Jun 2015 19:09:00 -0000	[thread overview]
Message-ID: <CAJgzZopOniu-Uh128-y3f61zx04D=U-QtjgYTps7sxvef-Nw8g@mail.gmail.com> (raw)

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>


             reply	other threads:[~2015-06-22 19:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 19:09 enh [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJgzZopOniu-Uh128-y3f61zx04D=U-QtjgYTps7sxvef-Nw8g@mail.gmail.com' \
    --to=enh@google.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox