This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] HP-UX 10.X reentrant functions
- From: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Mar 2011 18:26:03 -0500
- Subject: [committed] HP-UX 10.X reentrant functions
- Reply-to: John David Anglin <dave dot anglin at nrc-cnrc dot gc dot ca>
In HP-UX 10, the _r suffix routines are only declared when _REENTRANT
is defined. Previously, we only defined _REENTRANT when -threads was
specified (DCE thread model). However, we also need the reentrant
functions in the single thread model for libgfortran. As far as I
can tell, the reentrant functions work fine without linking with
-lcma. This similar to the situation on HP-UX 11 where the _REENTRANT
guard has been removed. The only remaining guard is on `errno'.
In studying this, I learned that libc had been enhanced so that libc_r
was no longer needed on HP-UX 10. Indeed, libc has a couple of additional
reentrant functions. In HP-UX 10.30, the library changed to a POSIX 1c
implementations libc_r was provided in HP-UX 10 for HP-UX 9 compatibility.
So, I've changed the thread linkage to use libc on HP-UX 10.
Tested on hppa1.1.-hp-hpux10.20 with no regressions. Committed to trunk.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2011-03-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* config/pa/pa-hpux10.h (TARGET_OS_CPP_BUILTINS): Define _REENTRANT
when _HPUX_SOURCE is defined.
(LIB_SPEC): Use -lc instead of -lc_r when -threads is specified.
Index: config/pa/pa-hpux10.h
===================================================================
--- config/pa/pa-hpux10.h (revision 170562)
+++ config/pa/pa-hpux10.h (working copy)
@@ -42,12 +42,14 @@
if (c_dialect_cxx ()) \
{ \
builtin_define ("_HPUX_SOURCE"); \
+ builtin_define ("_REENTRANT"); \
builtin_define ("_INCLUDE_LONGLONG"); \
builtin_define ("__STDCPP__"); \
} \
else if (!flag_iso) \
{ \
builtin_define ("_HPUX_SOURCE"); \
+ builtin_define ("_REENTRANT"); \
if (preprocessing_trad_p ()) \
{ \
builtin_define ("hp9000s800"); \
@@ -111,7 +113,7 @@
"%{!shared:\
%{!p:%{!pg:\
%{!threads:-lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}\
- %{threads:-lcma -lc_r}}}\
+ %{threads:-lcma -lc}}}\
%{p:%{!pg:-lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
%{pg:-lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}"