From patchwork Sun Dec 9 19:57:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 204780 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 9212F2C01FA for ; Mon, 10 Dec 2012 06:57:51 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1355687871; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=k7CgN3t5UBfJsYKNtYYs5TZOydo=; b=EsWPdL5ToGSPbCF graguuHNd0Ywo8nZWYmo6ZpyJbrLBzIWLrdaVQ2QQboZ93UdaABTwJkpcosNgcXN jDpib7uQd7n008oceshb3UZad6ESFe03qXj3QuI3NB09FktACWxZvUGXnBY/o5es +fdWU47iHv5e01P8QugVURGBEeUg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=vPjPs33NEPS0BDEh6HeMAvc3n2cw5UHFqr2y+4c4kbUWpC4awsgZq+CfhBzFuE QFijYRGm8fMKJbo9Wr/MYyYtYk9igUXVBmp4lrT+5ke4wJ4bWNmiZXUJZyHNX9fP H38JQzpYm8sl82gJg0xpWrkVAgE+WXZeURHsNOFmBQTIM=; Received: (qmail 24164 invoked by alias); 9 Dec 2012 19:57:47 -0000 Received: (qmail 24152 invoked by uid 22791); 9 Dec 2012 19:57:46 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, 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; Sun, 09 Dec 2012 19:57:42 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id F23E44CF1; Sun, 9 Dec 2012 14:57:39 -0500 (EST) Date: Sun, 9 Dec 2012 14:57:38 -0500 From: John David Anglin To: gcc-patches@gcc.gnu.org Subject: [PATCH, libbacktrace] Find executable on ia64 and 64-bit hppa hpux Message-ID: <20121209195737.GA20382@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 The getexecname function is not availble on HP-UX. This patch provides an alternative techique to obtain the executable path on HP-UX ELF targets. These have the dlget and dlgetname calls. I believe that this requires the dld.sl library be linked with the application which is the normal case. With this change and the other libbacktrace fixes that I previously posted, libbacktrace now works on hppa64-hp-hpux11.11. Don't have an ia64 system, so I can't test there. There is an alternative technique available using the pstat interface in HP-UX 11.11 and later. It's also possible to use the pstat interface and a file system walk on earlier HP-UX versions. However, this is painfully slow on large file systems. It would probably be better to use argv[0] and some additional checks. 32-bit hppa*-*-hpux* uses the SOM object format. Don't know how hard it would be to port libbacktrace to it. As a result, BACKTRACE_SUPPORTED is 0. However, libbacktrace is still called and fails in finding the executable. For example, /test/gnu/gcc/gcc/gcc/testsuite/g++.dg/pr48660.C:16:18: internal compiler error: in simplify_subreg, at simplify-rtx.c:5682 libbacktrace could not find executable to open Please submit a full bug report,with preprocessed source if appropriate. Not sure what would happen if libbacktrace found the executable. OK for trunk? Dave Index: fileline.c =================================================================== --- fileline.c (revision 194325) +++ fileline.c (working copy) @@ -42,8 +42,23 @@ #include "internal.h" #ifndef HAVE_GETEXECNAME +#if defined(__hpux) && (defined(__ia64) || defined(_LP64)) +#include +#define getexecname getexecname_hpux + +static char * +getexecname_hpux (void) +{ + struct load_module_desc desc; + + dlget(-2, &desc, sizeof(desc)); + return dlgetname(&desc, sizeof(desc), NULL, 0, 0); +} + +#else #define getexecname() NULL #endif +#endif /* Initialize the fileline information from the executable. Returns 1 on success, 0 on failure. */