public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [GDB][PR gdb/20457] Fix builds broken by proc-service changes.
@ 2016-08-12 14:16 Matthew Wahab
  2016-08-15 10:22 ` Gary Benson
  2016-08-15 11:48 ` Yao Qi
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Wahab @ 2016-08-12 14:16 UTC (permalink / raw)
  To: gdb-patches

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

Hello,

GLIBC BZ#20311 introduced a change to install proc_service.h so that gdb
didn't have to use the version it embeds in gdb_proc_service.h. The
embedded version is guarded by HAVE_PROC_SERVICE_H and
gdb_proc_service.h has a number other of includes and definitions, all
of which are uncondional except for an include for gregset.h. This is
only included if HAVE_PROC_SERIVCE_H is not defined.

This causes a build failure when cross compiling gdb with the latest
glibc because type definitions in gregset are used independently of
HAVE_PROC_SERIVCE_H. In particular, they are used in gdb_proc_service.h
when PRFPREGSET_T_BROKEN is set.

The error messages on the failure are
----
binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
not name a type; did you mean ‘elf_fpregset_t’?
  typedef gdb_fpregset_t gdb_prfpregset_t;
          ^~~~~~~~~~~~~~
          elf_fpregset_t

binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
not name a type; did you mean ‘elf_fpregset_t’?
  typedef gdb_fpregset_t gdb_prfpregset_t;
          ^~~~~~~~~~~~~~
          elf_fpregset_t

binutils-gdb/gdb/proc-service.c:218:15: error: ‘gdb_prfpregset_t’ does
not name a type; did you mean ‘gdb_fpregset_t’?
          const gdb_prfpregset_t *fpregset)
                ^~~~~~~~~~~~~~~~
                gdb_fpregset_t
----

This patch moves the include for gregset.h to before the code guarded by
HAVE_PROC_SERIVCE_H, so that it is always included. This is enough to
fix the build.

The macro PRFPREGSET_T_BROKEN is set by the configure script which uses
AC_TRY_RUN to test the sizeof (prfregset_t) and is always set for
cross-compiled builds. It's probably better to do the test using
AC_CHECK_SIZEOF, so that cross-compiled build get the correct value.
I'll send a follow-up patch to do that.

Tested by building gdb for target and host aarch64-none-linux-gnu
against previous and current glibc and by cross-compiling for
aarch64-none-linux-gnu with new glibc on an x86_64-pc-linux-gnu host.

Is this ok?
Matthew

2016-08-12  Matthew Wahab  <matthew.wahab@arm.com>

	PR gdb/20457
	* gdb_proc_service.h: Add an include of gregset.h
         [!HAVE_PROC_SERVICE_H]: Remove the include of gregset.h.

[-- Attachment #2: 0001-GDB-Fix-builds-broken-by-proc-service-changes.patch --]
[-- Type: text/x-patch, Size: 1154 bytes --]

From 03f2f5abae5c5cd0c37609d5a4056aed83524a1d Mon Sep 17 00:00:00 2001
From: Matthew Wahab <matthew.wahab@arm.com>
Date: Tue, 9 Aug 2016 09:49:55 +0100
Subject: [PATCH] [GDB] Fix builds broken by proc-service changes.

This patch moves the include for gregset.h to before the code guarded by
HAVE_PROC_SERIVCE_H, so that it is always included. This is enough to
fix the build.

2016-08-12  Matthew Wahab  <matthew.wahab@arm.com>

	PR gdb/20457
	* gdb_proc_service.h: Add an include of gregset.h
        [!HAVE_PROC_SERVICE_H]: Remove the include of gregset.h.
---
 gdb/gdb_proc_service.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdb_proc_service.h b/gdb/gdb_proc_service.h
index 04d3c03..38b98fc 100644
--- a/gdb/gdb_proc_service.h
+++ b/gdb/gdb_proc_service.h
@@ -21,6 +21,8 @@
 
 #include <sys/types.h>
 
+#include "gregset.h"
+
 #ifdef HAVE_PROC_SERVICE_H
 
 /* glibc's proc_service.h doesn't wrap itself with extern "C".  Need
@@ -60,8 +62,6 @@ EXTERN_C_POP
 #include <sys/procfs.h>
 #endif
 
-#include "gregset.h"
-
 EXTERN_C_PUSH
 
 /* Functions in this interface return one of these status codes.  */
-- 
2.1.4


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

* Re: [GDB][PR gdb/20457] Fix builds broken by proc-service changes.
  2016-08-12 14:16 [GDB][PR gdb/20457] Fix builds broken by proc-service changes Matthew Wahab
@ 2016-08-15 10:22 ` Gary Benson
  2016-08-15 11:48 ` Yao Qi
  1 sibling, 0 replies; 3+ messages in thread
From: Gary Benson @ 2016-08-15 10:22 UTC (permalink / raw)
  To: Matthew Wahab; +Cc: gdb-patches

Hi Matthew,

Matthew Wahab wrote:
> This patch moves the include for gregset.h to before the code
> guarded by HAVE_PROC_SERIVCE_H, so that it is always included.
> This is enough to fix the build.

This patch looks good to me, though I'm not a maintainer so can't
approve a push.

Cheers,
Gary

-- 
http://gbenson.net/

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

* Re: [GDB][PR gdb/20457] Fix builds broken by proc-service changes.
  2016-08-12 14:16 [GDB][PR gdb/20457] Fix builds broken by proc-service changes Matthew Wahab
  2016-08-15 10:22 ` Gary Benson
@ 2016-08-15 11:48 ` Yao Qi
  1 sibling, 0 replies; 3+ messages in thread
From: Yao Qi @ 2016-08-15 11:48 UTC (permalink / raw)
  To: Matthew Wahab; +Cc: gdb-patches

On Fri, Aug 12, 2016 at 3:15 PM, Matthew Wahab
<matthew.wahab@foss.arm.com> wrote:
> Hello,
>
> GLIBC BZ#20311 introduced a change to install proc_service.h so that gdb
> didn't have to use the version it embeds in gdb_proc_service.h. The
> embedded version is guarded by HAVE_PROC_SERVICE_H and
> gdb_proc_service.h has a number other of includes and definitions, all
> of which are uncondional except for an include for gregset.h. This is
> only included if HAVE_PROC_SERIVCE_H is not defined.
>
> This causes a build failure when cross compiling gdb with the latest
> glibc because type definitions in gregset are used independently of
> HAVE_PROC_SERIVCE_H. In particular, they are used in gdb_proc_service.h
> when PRFPREGSET_T_BROKEN is set.
>
> The error messages on the failure are
> ----
> binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
> not name a type; did you mean ‘elf_fpregset_t’?
>  typedef gdb_fpregset_t gdb_prfpregset_t;
>          ^~~~~~~~~~~~~~
>          elf_fpregset_t
>
> binutils-gdb/gdb/gdb_proc_service.h:173:9: error: ‘gdb_fpregset_t’ does
> not name a type; did you mean ‘elf_fpregset_t’?
>  typedef gdb_fpregset_t gdb_prfpregset_t;
>          ^~~~~~~~~~~~~~
>          elf_fpregset_t
>
> binutils-gdb/gdb/proc-service.c:218:15: error: ‘gdb_prfpregset_t’ does
> not name a type; did you mean ‘gdb_fpregset_t’?
>          const gdb_prfpregset_t *fpregset)
>                ^~~~~~~~~~~~~~~~
>                gdb_fpregset_t
> ----
>
> This patch moves the include for gregset.h to before the code guarded by
> HAVE_PROC_SERIVCE_H, so that it is always included. This is enough to
> fix the build.

Hi Matthew,
Could you please copy these words above to commit log?  They are very
useful.

>
> The macro PRFPREGSET_T_BROKEN is set by the configure script which uses
> AC_TRY_RUN to test the sizeof (prfregset_t) and is always set for
> cross-compiled builds. It's probably better to do the test using
> AC_CHECK_SIZEOF, so that cross-compiled build get the correct value.
> I'll send a follow-up patch to do that.

Thanks for doing this...

>
> Tested by building gdb for target and host aarch64-none-linux-gnu
> against previous and current glibc and by cross-compiling for
> aarch64-none-linux-gnu with new glibc on an x86_64-pc-linux-gnu host.
>
> Is this ok?

Yes, it is OK.  Please push it in to both master and 7.12 branch.

-- 
Yao (齐尧)

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

end of thread, other threads:[~2016-08-15 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-12 14:16 [GDB][PR gdb/20457] Fix builds broken by proc-service changes Matthew Wahab
2016-08-15 10:22 ` Gary Benson
2016-08-15 11:48 ` Yao Qi

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).