From patchwork Sat Feb 10 23:30:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 871717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473026-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jS07pM0k"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zf7Tn17NJz9sRW for ; Sun, 11 Feb 2018 10:30:52 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; q= dns; s=default; b=F2CsYpYNjkIDlce1IRaOfrO6fICGZMg2Dtff8FedEYPtsp iI+8FDoFDUmE1UYMaYvI+qR1jigz349INLR41jatz5hL7ZymjtrncRzFELS2IP7k nKN4LJyMpfDznO7qrI6L+Pk6PK0zD5AByXnvH1fAvKWOIc0aB5UYyoWWtAjxc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; s= default; bh=fX7LJ+0+rjmwBMjt3vkox3VZFlY=; b=jS07pM0kuM87uRlRvmoV JszZYfZug0F0ZohB4u2LyVbFpVvLlkVUUcMtR/Row+cUT7+avhIKrlVmlUNgXLOm +FurYS3PbIH30kj+6Ou+0J0vAoZi08yAoxovQzGiqlSryyYIQC9KYNVGcloGiYkl ncySYKmx0PYvDFYNGdoV5QI= Received: (qmail 124642 invoked by alias); 10 Feb 2018 23:30:44 -0000 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 Received: (qmail 124393 invoked by uid 89); 10 Feb 2018 23:30:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:sk:2018021, sk:hppa-un, sk:hppaun, H*RU:sk:2018021 X-HELO: mtlfep01.bell.net Received: from belmont79srvr.owm.bell.net (HELO mtlfep01.bell.net) (184.150.200.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Feb 2018 23:30:17 +0000 Received: from bell.net mtlfep01 184.150.200.30 by mtlfep01.bell.net with ESMTP id <20180210233013.RYCW19887.mtlfep01.bell.net@mtlspm02.bell.net> for ; Sat, 10 Feb 2018 18:30:13 -0500 Received: from [192.168.2.49] (really [70.31.74.127]) by mtlspm02.bell.net with ESMTP id <20180210233013.HCLG6415.mtlspm02.bell.net@[192.168.2.49]>; Sat, 10 Feb 2018 18:30:13 -0500 To: GCC Patches From: John David Anglin Subject: [committed] hppa: Fix conflict between -pg and -mlong-call options Cc: Camm Maguire , Helge Deller Message-ID: <5A7F8084.3060206@bell.net> Date: Sat, 10 Feb 2018 18:30:12 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 The attached patch fixes an oversight in hppa_profile_hook. We need to mark the SYMBOL_REF for _mcount as a function label. When the -mlong-call option is used, the call to _mcount is converted to an indirect call. In that case, we need the function pointer to point to a procedure label which points to a function descriptor. This is necessary to correctly load the PIC register. Marking the SYMBOL_REF causes this to happen. Tested on hppa-unknown-linux-gnu with no regressions. Committed to trunk. This bug caused a build error for gcl. Thanks to Camm Maguire for debugging the problem. Dave Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 257545) +++ config/pa/pa.c (working copy) @@ -4578,13 +4578,17 @@ lcla2 and load_offset_label_address insn patterns. */ rtx reg = gen_reg_rtx (SImode); rtx_code_label *label_rtx = gen_label_rtx (); - rtx mcount = gen_rtx_MEM (Pmode, gen_rtx_SYMBOL_REF (Pmode, "_mcount")); int reg_parm_stack_space = REG_PARM_STACK_SPACE (NULL_TREE); - rtx arg_bytes, begin_label_rtx; + rtx arg_bytes, begin_label_rtx, mcount, sym; rtx_insn *call_insn; char begin_label_name[16]; bool use_mcount_pcrel_call; + /* Set up call destination. */ + sym = gen_rtx_SYMBOL_REF (Pmode, "_mcount"); + pa_encode_label (sym); + mcount = gen_rtx_MEM (Pmode, sym); + /* If we can reach _mcount with a pc-relative call, we can optimize loading the address of the current function. This requires linker long branch stub support. */