Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [hpux] Fix build problem on hpux
@ 2006-03-09 18:05 Randolph Chung
  2006-03-09 19:14 ` Mark Kettenis
  0 siblings, 1 reply; 11+ messages in thread
From: Randolph Chung @ 2006-03-09 18:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: John David Anglin

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

This fixes the build problem on HPUX reported recently by Dave Anglin 
(PR/2097). Thanks to Dave for debugging the problem :)

I'll check this in in a few days unless I hear objections.

randolph

[-- Attachment #2: hpcomp.diff --]
[-- Type: text/x-patch, Size: 1429 bytes --]

2005-03-09  Randolph Chung  <tausq@debian.org>

	PR gdb/2097
	* hpread.c (hpread_start_psymtab): Remove hpread_psymtab_to_symtab
	declaration.
	* config/pa/hppahpux.mt (MT_CFLAGS): Define _XOPEN_SOURCE_EXTENDED.

Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.58
diff -u -p -r1.58 hpread.c
--- hpread.c	17 Dec 2005 22:34:01 -0000	1.58
+++ hpread.c	9 Mar 2006 15:28:16 -0000
@@ -2385,7 +2386,6 @@ hpread_start_psymtab (struct objfile *ob
 		      struct partial_symbol **static_syms)
 {
   int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
-  extern void hpread_psymtab_to_symtab ();
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
 			filename, textlow, global_syms, static_syms);
Index: config/pa/hppahpux.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/hppahpux.mt,v
retrieving revision 1.7
diff -u -p -r1.7 hppahpux.mt
--- config/pa/hppahpux.mt	13 Dec 2004 04:06:16 -0000	1.7
+++ config/pa/hppahpux.mt	9 Mar 2006 15:28:16 -0000
@@ -1,4 +1,4 @@
 # Target: HP PA-RISC running hpux
-MT_CFLAGS = -DPA_SOM_ONLY=1
+MT_CFLAGS = -DPA_SOM_ONLY=1 -D_XOPEN_SOURCE_EXTENDED
 TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o corelow.o somread.o hpread.o solib-som.o solib-pa64.o solib.o
 DEPRECATED_TM_FILE= tm-hppah.h

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

* Re: [hpux] Fix build problem on hpux
  2006-03-09 18:05 [hpux] Fix build problem on hpux Randolph Chung
@ 2006-03-09 19:14 ` Mark Kettenis
  2006-03-10  1:35   ` Randolph Chung
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2006-03-09 19:14 UTC (permalink / raw)
  To: randolph; +Cc: gdb-patches, dave

> Date: Thu, 09 Mar 2006 23:37:48 +0800
> From: Randolph Chung <randolph@tausq.org>
> 
> This fixes the build problem on HPUX reported recently by Dave Anglin 
> (PR/2097). Thanks to Dave for debugging the problem :)
> 
> I'll check this in in a few days unless I hear objections.
>
> Index: config/pa/hppahpux.mt
> ===================================================================
> RCS file: /cvs/src/src/gdb/config/pa/hppahpux.mt,v
> retrieving revision 1.7
> diff -u -p -r1.7 hppahpux.mt
> --- config/pa/hppahpux.mt	13 Dec 2004 04:06:16 -0000	1.7
> +++ config/pa/hppahpux.mt	9 Mar 2006 15:28:16 -0000
> @@ -1,4 +1,4 @@
>  # Target: HP PA-RISC running hpux
> -MT_CFLAGS = -DPA_SOM_ONLY=1
> +MT_CFLAGS = -DPA_SOM_ONLY=1 -D_XOPEN_SOURCE_EXTENDED
>  TDEPFILES= hppa-tdep.o hppa-hpux-tdep.o corelow.o somread.o hpread.o solib-som.o solib-pa64.o solib.o
>  DEPRECATED_TM_FILE= tm-hppah.h

This can't be right.  The point is to add -D_XOPEN_SOURCE_EXTENDED
whenever we compile *on* HP-UX, not whenever we're targeting HP-UX.
This should be handled using autoconf, much in the same way as we do
for _GNU_SOURCE, since it affects the functionality made available by
the OS.

The other bit of the patch is ok of course, so you might as well check
that bit in.

Mark


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

* Re: [hpux] Fix build problem on hpux
  2006-03-09 19:14 ` Mark Kettenis
@ 2006-03-10  1:35   ` Randolph Chung
  2006-03-10  1:48     ` John David Anglin
  2006-03-10 12:50     ` Daniel Jacobowitz
  0 siblings, 2 replies; 11+ messages in thread
From: Randolph Chung @ 2006-03-10  1:35 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches, dave

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

> This can't be right.  The point is to add -D_XOPEN_SOURCE_EXTENDED
> whenever we compile *on* HP-UX, not whenever we're targeting HP-UX.
> This should be handled using autoconf, much in the same way as we do
> for _GNU_SOURCE, since it affects the functionality made available by
> the OS.

How about this instead?

randolph

[-- Attachment #2: hpcomp.diff --]
[-- Type: text/x-patch, Size: 2536 bytes --]

2005-03-09  Randolph Chung  <tausq@debian.org>

	* hpread.c (hpread_start_psymtab): Remove hpread_psymtab_to_symtab
	declaration.
	* acinclude.m4 (gdb_AC_HPUX): Define.
	* config.in (_XOPEN_SOURCE_EXTENDED): Define if needed.
	* configure.ac: Call gdb_AC_HPUX.
	* configure: Regenerate.

Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.58
diff -u -p -r1.58 hpread.c
--- hpread.c	17 Dec 2005 22:34:01 -0000	1.58
+++ hpread.c	9 Mar 2006 15:28:16 -0000
@@ -2385,7 +2386,6 @@ hpread_start_psymtab (struct objfile *ob
 		      struct partial_symbol **static_syms)
 {
   int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
-  extern void hpread_psymtab_to_symtab ();
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
 			filename, textlow, global_syms, static_syms);
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.13
diff -u -p -r1.13 acinclude.m4
--- acinclude.m4	17 Dec 2005 22:33:59 -0000	1.13
+++ acinclude.m4	10 Mar 2006 00:16:44 -0000
@@ -987,3 +987,14 @@ if test x = y ; then
 fi
 ])
 
+AC_DEFUN(gdb_AC_HPUX,
+[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
+AC_BEFORE([$0], [AC_TRY_RUN])dnl
+AC_MSG_CHECKING(for HPUX)
+AC_EGREP_CPP(yes,
+[#ifdef _HPUX_SOURCE
+  yes
+#endif
+], [AC_MSG_RESULT(yes); AC_DEFINE(_XOPEN_SOURCE_EXTENDED)], AC_MSG_RESULT(no))
+])
+
Index: config.in
===================================================================
RCS file: /cvs/src/src/gdb/config.in,v
retrieving revision 1.82
diff -u -p -r1.82 config.in
--- config.in	3 Jul 2005 16:05:11 -0000	1.82
+++ config.in	10 Mar 2006 00:16:44 -0000
@@ -607,6 +607,13 @@
 # undef _ALL_SOURCE
 #endif
 
+/* Define to 1 if on HPUX.
+   System headers sometimes define this.
+   We just want to avoid a redefinition error message.  */
+#ifndef _XOPEN_SOURCE_EXTENDED
+# undef _XOPEN_SOURCE_EXTENDED
+#endif
+
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.30
diff -u -p -r1.30 configure.ac
--- configure.ac	21 Feb 2006 21:02:25 -0000	1.30
+++ configure.ac	10 Mar 2006 00:18:27 -0000
@@ -30,6 +30,7 @@ AM_MAINTAINER_MODE
 AC_PROG_CC
 AC_GNU_SOURCE
 AC_AIX
+gdb_AC_HPUX
 AC_ISC_POSIX
 AM_PROG_CC_STDC
 

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

* Re: [hpux] Fix build problem on hpux
  2006-03-10  1:35   ` Randolph Chung
@ 2006-03-10  1:48     ` John David Anglin
  2006-03-10  2:33       ` Randolph Chung
  2006-03-10 12:50     ` Daniel Jacobowitz
  1 sibling, 1 reply; 11+ messages in thread
From: John David Anglin @ 2006-03-10  1:48 UTC (permalink / raw)
  To: Randolph Chung; +Cc: mark.kettenis, gdb-patches

> Index: acinclude.m4
> ===================================================================
> RCS file: /cvs/src/src/gdb/acinclude.m4,v
> retrieving revision 1.13
> diff -u -p -r1.13 acinclude.m4
> --- acinclude.m4	17 Dec 2005 22:33:59 -0000	1.13
> +++ acinclude.m4	10 Mar 2006 00:16:44 -0000
> @@ -987,3 +987,14 @@ if test x = y ; then
>  fi
>  ])
>  
> +AC_DEFUN(gdb_AC_HPUX,
> +[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
> +AC_BEFORE([$0], [AC_TRY_RUN])dnl
> +AC_MSG_CHECKING(for HPUX)
> +AC_EGREP_CPP(yes,
> +[#ifdef _HPUX_SOURCE
> +  yes
> +#endif
> +], [AC_MSG_RESULT(yes); AC_DEFINE(_XOPEN_SOURCE_EXTENDED)], AC_MSG_RESULT(no))
> +])

Did you try this with GCC 4.0.0 or later?  These automatically define
_XOPEN_SOURCE_EXTENDED (libstdc++ needed it for wchar support).  I'm
afraid that you might get warnings.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


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

* Re: [hpux] Fix build problem on hpux
  2006-03-10  1:48     ` John David Anglin
@ 2006-03-10  2:33       ` Randolph Chung
  2006-03-10 11:15         ` John David Anglin
  0 siblings, 1 reply; 11+ messages in thread
From: Randolph Chung @ 2006-03-10  2:33 UTC (permalink / raw)
  To: John David Anglin; +Cc: mark.kettenis, gdb-patches

> Did you try this with GCC 4.0.0 or later?  These automatically define
> _XOPEN_SOURCE_EXTENDED (libstdc++ needed it for wchar support).  I'm
> afraid that you might get warnings.

The config.in file takes care to make sure there are no redefinitions.

I just checked this again with gcc-4.0.1 and gcc-4.1.0 on
hppa2.0w-hp-hpux11.11

There a different problem on hppa64-hp-hpux11.11 (with iconv) that still
needs to be fixed.

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


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

* Re: [hpux] Fix build problem on hpux
  2006-03-10  2:33       ` Randolph Chung
@ 2006-03-10 11:15         ` John David Anglin
  0 siblings, 0 replies; 11+ messages in thread
From: John David Anglin @ 2006-03-10 11:15 UTC (permalink / raw)
  To: Randolph Chung; +Cc: mark.kettenis, gdb-patches

> There a different problem on hppa64-hp-hpux11.11 (with iconv) that still
> needs to be fixed.

This is another one of the functions that I hate.  This has contributed
to more build failures ...

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


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

* Re: [hpux] Fix build problem on hpux
  2006-03-10  1:35   ` Randolph Chung
  2006-03-10  1:48     ` John David Anglin
@ 2006-03-10 12:50     ` Daniel Jacobowitz
       [not found]       ` <4410EE58.1060007@tausq.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-03-10 12:50 UTC (permalink / raw)
  To: Randolph Chung; +Cc: Mark Kettenis, gdb-patches, dave

On Fri, Mar 10, 2006 at 08:19:21AM +0800, Randolph Chung wrote:
> 2005-03-09  Randolph Chung  <tausq@debian.org>
> 
> 	* hpread.c (hpread_start_psymtab): Remove hpread_psymtab_to_symtab
> 	declaration.
> 	* acinclude.m4 (gdb_AC_HPUX): Define.
> 	* config.in (_XOPEN_SOURCE_EXTENDED): Define if needed.
> 	* configure.ac: Call gdb_AC_HPUX.
> 	* configure: Regenerate.

config.in is a generated file, as the comment at the top says.

> +AC_DEFUN(gdb_AC_HPUX,
> +[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
> +AC_BEFORE([$0], [AC_TRY_RUN])dnl
> +AC_MSG_CHECKING(for HPUX)
> +AC_EGREP_CPP(yes,
> +[#ifdef _HPUX_SOURCE
> +  yes
> +#endif
> +], [AC_MSG_RESULT(yes); AC_DEFINE(_XOPEN_SOURCE_EXTENDED)], AC_MSG_RESULT(no))
> +])
> +

What does the existance of _HPUX_SOURCE have to do with this?

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [hpux] Fix build problem on hpux
       [not found]           ` <4410FF26.40509@tausq.org>
@ 2006-03-26  8:33             ` Randolph Chung
  2006-03-28 22:29               ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Randolph Chung @ 2006-03-26  8:33 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

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

Attached is a new cleaned up version of my HPUX 32-bit compile fix. Hope 
this is cleaner than what I posted before. Is this ok?

randolph


[-- Attachment #2: hpcomp.diff --]
[-- Type: text/x-patch, Size: 1751 bytes --]

2005-03-26  Randolph Chung  <tausq@debian.org>

	* hpread.c (hpread_start_psymtab): Remove hpread_psymtab_to_symtab
	declaration.
	* configure.ac: Define _XOPEN_SOURCE_EXTENDED on HPUX host.
	* configure: Regenerate.
	* config.in: Regenerate.

Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.58
diff -u -p -r1.58 hpread.c
--- hpread.c	17 Dec 2005 22:34:01 -0000	1.58
+++ hpread.c	9 Mar 2006 15:28:16 -0000
@@ -2385,7 +2386,6 @@ hpread_start_psymtab (struct objfile *ob
 		      struct partial_symbol **static_syms)
 {
   int offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
-  extern void hpread_psymtab_to_symtab ();
   struct partial_symtab *result =
   start_psymtab_common (objfile, objfile->section_offsets,
 			filename, textlow, global_syms, static_syms);
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.30
diff -u -p -r1.30 configure.ac
--- configure.ac	21 Feb 2006 21:02:25 -0000	1.30
+++ configure.ac	26 Mar 2006 07:52:44 -0000
@@ -1519,6 +1519,19 @@ if test "x$build_nlm" = xyes; then
    AC_CONFIG_SUBDIRS(nlm)
 fi
 
+# When building on HPUX, we need to define _XOPEN_SOURCE_EXTENDED to get
+# proper prototypes.
+case $host_os in
+hpux*)
+    AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
+    [/* Define to 1 if on HPUX.  */
+#ifndef _XOPEN_SOURCE_EXTENDED
+# undef _XOPEN_SOURCE_EXTENDED
+#endif])dnl
+    AC_DEFINE([_XOPEN_SOURCE_EXTENDED])
+  ;;
+esac
+
 # If hostfile (XM_FILE) and/or targetfile (DEPRECATED_TM_FILE) and/or
 # nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
 # to an empty version.

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

* Re: [hpux] Fix build problem on hpux
  2006-03-26  8:33             ` Randolph Chung
@ 2006-03-28 22:29               ` Daniel Jacobowitz
  2006-03-29  0:28                 ` Randolph Chung
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-03-28 22:29 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

On Sun, Mar 26, 2006 at 03:55:48PM +0800, Randolph Chung wrote:
> +# When building on HPUX, we need to define _XOPEN_SOURCE_EXTENDED to get
> +# proper prototypes.
> +case $host_os in
> +hpux*)
> +    AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
> +    [/* Define to 1 if on HPUX.  */
> +#ifndef _XOPEN_SOURCE_EXTENDED
> +# undef _XOPEN_SOURCE_EXTENDED
> +#endif])dnl
> +    AC_DEFINE([_XOPEN_SOURCE_EXTENDED])
> +  ;;
> +esac

I am most confused as to what you are trying to do.  You should leave
_XOPEN_SOURCE_EXTENDED alone on non-HP/UX, and make sure it is
appropriately defined on HP/UX.  #ifndef followed by #undef doesn't
do much.  And I don't think AH_VERBATIM does what you think; it changes
the generated config.in, not the generated config.h, so it affects all
platforms.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [hpux] Fix build problem on hpux
  2006-03-28 22:29               ` Daniel Jacobowitz
@ 2006-03-29  0:28                 ` Randolph Chung
  2006-03-29  4:36                   ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Randolph Chung @ 2006-03-29  0:28 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

Daniel Jacobowitz wrote:
> On Sun, Mar 26, 2006 at 03:55:48PM +0800, Randolph Chung wrote:
> 
>>+# When building on HPUX, we need to define _XOPEN_SOURCE_EXTENDED to get
>>+# proper prototypes.
>>+case $host_os in
>>+hpux*)
>>+    AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
>>+    [/* Define to 1 if on HPUX.  */
>>+#ifndef _XOPEN_SOURCE_EXTENDED
>>+# undef _XOPEN_SOURCE_EXTENDED
>>+#endif])dnl
>>+    AC_DEFINE([_XOPEN_SOURCE_EXTENDED])
>>+  ;;
>>+esac
> 
> 
> I am most confused as to what you are trying to do.  You should leave
> _XOPEN_SOURCE_EXTENDED alone on non-HP/UX, and make sure it is
> appropriately defined on HP/UX.  

Yes, this is exactly what I am trying to do. What is confusing.

> #ifndef followed by #undef doesn't
> do much.  And I don't think AH_VERBATIM does what you think; it changes
> the generated config.in, not the generated config.h, so it affects all
> platforms.

Yes, I know. Normally autoheader will generate just the #undef line; 
the above makes it generate the #undef inside the #ifndef. This is the 
same logic used to generate the _GNU_SOURCE #define in config.in. The 
#undef is changed into a #define by configure on hpux. On other systems, 
you are right that the three lines don't do anything, and that is the 
desired effect.

The problem is that we are trying to avoid a redefinition of 
_XOPEN_SOURCE_EXTENDED, in case this define is by default enabled on a 
particular platform.

randolph


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

* Re: [hpux] Fix build problem on hpux
  2006-03-29  0:28                 ` Randolph Chung
@ 2006-03-29  4:36                   ` Daniel Jacobowitz
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-03-29  4:36 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

On Wed, Mar 29, 2006 at 08:04:14AM +0800, Randolph Chung wrote:
> Yes, this is exactly what I am trying to do. What is confusing.

I read it, it made no sense :-)

Now I understand.  A clarifying comment about how it works would
be nice.  Otherwise, OK.

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2006-03-29  0:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-09 18:05 [hpux] Fix build problem on hpux Randolph Chung
2006-03-09 19:14 ` Mark Kettenis
2006-03-10  1:35   ` Randolph Chung
2006-03-10  1:48     ` John David Anglin
2006-03-10  2:33       ` Randolph Chung
2006-03-10 11:15         ` John David Anglin
2006-03-10 12:50     ` Daniel Jacobowitz
     [not found]       ` <4410EE58.1060007@tausq.org>
     [not found]         ` <20060310035929.GA12013@nevyn.them.org>
     [not found]           ` <4410FF26.40509@tausq.org>
2006-03-26  8:33             ` Randolph Chung
2006-03-28 22:29               ` Daniel Jacobowitz
2006-03-29  0:28                 ` Randolph Chung
2006-03-29  4:36                   ` Daniel Jacobowitz

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