From patchwork Thu Mar 10 23:26:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 86344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AB122B6F14 for ; Fri, 11 Mar 2011 10:26:14 +1100 (EST) Received: (qmail 9651 invoked by alias); 10 Mar 2011 23:26:12 -0000 Received: (qmail 9636 invoked by uid 22791); 10 Mar 2011 23:26:10 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hiauly1.hia.nrc.ca (HELO hiauly1.hia.nrc.ca) (132.246.10.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Mar 2011 23:26:06 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id 1DCCF5013; Thu, 10 Mar 2011 18:26:03 -0500 (EST) Date: Thu, 10 Mar 2011 18:26:03 -0500 From: John David Anglin To: gcc-patches@gcc.gnu.org Subject: [committed] HP-UX 10.X reentrant functions Message-ID: <20110310232602.GA22999@hiauly1.hia.nrc.ca> Reply-To: John David Anglin MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 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}}}}"