public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Java PATCH] Fix libjava bootstrap issues on HP-UX 11.00
@ 2006-06-29  0:15 Roger Sayle
  2006-06-29  1:30 ` Bryce McKinlay
  2006-06-29  1:48 ` John David Anglin
  0 siblings, 2 replies; 6+ messages in thread
From: Roger Sayle @ 2006-06-29  0:15 UTC (permalink / raw)
  To: gcc-patches, java-patches; +Cc: John David Anglin


The following two minor changes fix the default bootstrap failure on
hppa2.0w-hp-hpux11.00 for me.  The issue is that on my PA/HPUX system
the foo_r forms of libc functions aren't prototyped by the system
headers unless the macro _REENTRANT is defined.  If GCC is using the
posix thread model, then this macro is defined for us by the -pthread
command line option in THREADCXXFLAGS, but in the default "single"
thread model, it isn't and libjava fails with calls to undeclared
functions.

Rather than insert the necessary #define _REENTRANT hack into
libjava/gnu/classpath/natSystemProperties.cc and all the other
places that'd require it, libjava conventiently provides a
posix.h header specially for such hacks.  Unfortunately, it's
not currently included by java/io/natFilePosix.cc, so the second
hunk below adds the same #include <platform.h> idiom used elsewhere.

With these changes the libjava almost reaches the end of the
top-level "make bootstrap" for me, but unfortunately most/all?
of the compiled java programs "hang" when run, including the
gcj_dbtool invocation at the very end of the build!  Doh!.

Tested on hppa2.0w-hp-hpux11.00, configured with the command
"../gcc/configure --with-gnu-as --with-as=/usr/local/bin/as",
followed by "make bootstrap", where "as --version" is 2.15.

Is this patch ok for mainline?  Should we change the default
GCC thread model on hppa*-hp-hpux* to posix from single?  Is
there something else I'm doing wrong that's causing the java
executables to hang?  Many thanks in advance.  And also to the
folks who've managed to get gcj (almost) working on PA/HPUX.



2006-06-28  Roger Sayle  <roger@eyesopen.com>

	* include/posix.h: Ensure that _REENTRANT is defined on HP-UX.
	* java/io/natFilePosix.cc: #include <platform.h>.


Index: include/posix.h
===================================================================
*** include/posix.h	(revision 114960)
--- include/posix.h	(working copy)
*************** details.  */
*** 16,21 ****
--- 16,31 ----
     early so <standards.h> defines the correct version of __PIIX.  */
  #define _POSIX_PII_SOCKET

+ /* On HP-UX, _REENTRANT needs to be defined before #including <pwd.h>
+    in order to declare getpwuid_r.  With the "posix" thread model this is
+    done by the -pthread command line option in THREADCXXFLAGS.  However,
+    for GCC's "single" thread model, we need to do this ourselves.  */
+ #if defined (__hpux__)
+ #ifndef _REENTRANT
+ #define _REENTRANT 1
+ #endif
+ #endif
+
  #include <time.h>
  #include <sys/types.h>

Index: java/io/natFilePosix.cc
===================================================================
*** java/io/natFilePosix.cc	(revision 114960)
--- java/io/natFilePosix.cc	(working copy)
*************** Libgcj License.  Please consult the file
*** 9,14 ****
--- 9,15 ----
  details.  */

  #include <config.h>
+ #include <platform.h>

  #include <stdio.h>
  #include <errno.h>


Roger
--

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

end of thread, other threads:[~2006-07-05 21:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-29  0:15 [Java PATCH] Fix libjava bootstrap issues on HP-UX 11.00 Roger Sayle
2006-06-29  1:30 ` Bryce McKinlay
2006-06-29  1:48   ` John David Anglin
2006-06-29  1:48 ` John David Anglin
2006-07-05 17:46   ` Tom Tromey
2006-07-05 21:49     ` John David Anglin

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