From patchwork Sat Feb 11 00:15:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 140746 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 7BFF7B6F98 for ; Sat, 11 Feb 2012 11:16:41 +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=1329524201; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=sLKVZEw9vlrI+asEJrn34y6ufXg=; b=M5bj7PuXbSyipAb oVqG9gwwUZ3HMUvXEZ7TCB/QKKELVXBkytGngcZLKvM8JuzXq/nbbvck5W4O5IXl XdCoze5IJVK5uHQE0yPsY3NRhr088Cy1vK+h3epEcUW5hFNExgcSLeAkB/IsM/sZ hHP1l4OF4HBJlSmGun+HZsvWGVeI= 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:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NVvpYsoG6oCo+oxdBE+apBIBkdfdkrvLZdmYbgXJEPHxKOqDfeRcuneB18ppuT Z8KIX1uTfNz93jfNM4EHZHHBn+D257jpzisMJBq5kGEFu0DGTQW6j+sITff2ZOTb buKE7ujrnYifl7EsLqUTPJPKRVGfqE2kQeOgb18a7WHw4=; Received: (qmail 7881 invoked by alias); 11 Feb 2012 00:16:21 -0000 Received: (qmail 7861 invoked by uid 22791); 11 Feb 2012 00:16:17 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Feb 2012 00:16:00 +0000 Received: by daln34 with SMTP id n34so2634050dal.20 for ; Fri, 10 Feb 2012 16:15:59 -0800 (PST) Received: by 10.68.212.130 with SMTP id nk2mr21011579pbc.69.1328919359611; Fri, 10 Feb 2012 16:15:59 -0800 (PST) Received: by 10.68.212.130 with SMTP id nk2mr21011557pbc.69.1328919359479; Fri, 10 Feb 2012 16:15:59 -0800 (PST) Received: from coign.google.com ([2620:0:1000:2301:f2de:f1ff:fe40:72a8]) by mx.google.com with ESMTPS id x8sm17352786pbr.11.2012.02.10.16.15.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Feb 2012 16:15:58 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Tweak can-recover heuristic for SPARC Date: Fri, 10 Feb 2012 16:15:57 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlXzcr4zbeDJg3LVprGtyqdTNNsp/teG7JfjXBWcrgVbNNcukuqmgxwpMwi+80/i+5vj/CohUDwwWPlOUfzsZ9l83o7TvKTiD9kPAXMrfa0LebwVXreGAd0ZqYEXS1PHal9uTNKIot2jofraKcxUyaHsTcRvuZSIqjfIVD8QchQ+MLDi3U= X-IsSubscribed: yes 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 gccgo implementation of panic/recover uses the return address of a function which called recover in order to see if that function was invoke directly by defer. It does this by passing the address of a label which immediately follows the function call. This requires a small heuristic, because there may be some machine instructions between the function call and the label, even though they are adjacent in GIMPLE. On SPARC I needed to tweak that heuristic further, because on SPARC __builtin_return_address returns the address of the function call instruction, which is at least 8 bytes before the label. This patch implements that tweak. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu and sparc-sun-solaris2.11 (Solaris has other unrelated failures). Committed to mainline. Ian Index: libgo/runtime/go-recover.c =================================================================== --- libgo/runtime/go-recover.c (revision 183650) +++ libgo/runtime/go-recover.c (working copy) @@ -43,6 +43,14 @@ __go_can_recover (const void* retaddr) such as an instruction to adjust the stack pointer. */ ret = (const char *) retaddr; + +#ifdef __sparc__ + /* On SPARC the address we get, from __builtin_return_address, is + the address of the call instruction. Adjust forward, also + skipping the delayed instruction following the call. */ + ret += 8; +#endif + dret = (const char *) d->__retaddr; return ret <= dret && ret + 16 >= dret; }