From patchwork Fri May 25 08:03:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 136796 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3285681lji; Fri, 25 May 2018 01:27:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqVt4BlsgolybFDLYFwkuegTKoBgo77l1PSgzy5hsR/BoalHXF2HQczgrGbHxS69qSeuzSf X-Received: by 2002:a17:902:7c0e:: with SMTP id x14-v6mr1620021pll.389.1527236840524; Fri, 25 May 2018 01:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527236840; cv=none; d=google.com; s=arc-20160816; b=FgNLb7ctO+jd1gi1xFowqLTb9aK3wR+nrkSSOmoP4Y2dpye+lgvFv3Vg2zBKuO8eka DtTKs8n7FZY3MXkDHo52RhYAM+mESpardCNYdTM4DB/KsObskdy8gJ34WNc2jC2w1S93 ugZaqoLS+l/dL29xVk+efTyB7QirXnv1j9UL86NLjRJ0AwbvkjTHubW7EjlCtQxxjH06 vBo3S0/gjcy//1MQPINUjmtXf8OTCqu42Ll+d0c5YIV7POQYAXAa5nLUGmMZMGlkqdUx Dc3xeJNRaHyO457fouvEqIu3V9YplTluYu2RPltoZunmooZ0LrCk8ioxzGl+cKL7xMn7 rq+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=aMd8ALQ/yDjO0ErXbRmoEHCtlOb1P1kCPpNNwhnnzmc=; b=ApSCPlZzybTm4e1kbyxWsCFwlX+KHg0jXQyfQOAaAQZ5cXYKVg+ma1zoHjGRkU8u4z 3uo9kFTd7KxNB4jRTwSDlv3IhhM8iVrX7FKNtQ1eWlo1ZqXMIZkw9uFdY1s1+3MU5cSW /cXndUlOM8GoZHQV3WaFyuhqE0o4DR0OvEJRt0GmXpruw81jjeykCmYHC9k8im3a38GJ pOoc4T9GZ24ejTw9L8y/qHMVQrMuaa7teyBrZZBBhx7Voz1iUA10B5ua/5h1ODdVm4Zp Y6iaEg0+U9uVsWfCF3ks8tdgio2DZhxglJ11gxGUc7EDIE6egMj1cKvXrFATTlIma6ig jgLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=btjCdgJ6; spf=pass (google.com: domain of gcc-patches-return-478464-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-478464-patch=linaro.org@gcc.gnu.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z3-v6si22002596pln.292.2018.05.25.01.27.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 01:27:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-478464-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=btjCdgJ6; spf=pass (google.com: domain of gcc-patches-return-478464-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-478464-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=sMo /SCvp2qwA5nqRCixX6r8muyuciVl+ghWGxxgz8L19woprckC96SXYuacODyowIua F1NbCvSfxHbxF6WaTTZ/ssEH5mBEJs7ZCgWMAUL5ioq/e8fG4ywPjtjQW+JaP/Kr W8e25GT2nYhl3H1gh36/yuewynrISD55G02P7iOk= 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:from :to:subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=default; bh=gxIX3aSq9 3IRVZINpgkRWtud8/A=; b=btjCdgJ6TGTEgCquA2k6jkSU+dJHupS3Hmu01G0FD /dhpT/0BHE60ZXdNoKs/Vsu8FFUSlG6vPsG6gr46PlhyCgFYqoHulb5QuZM9UEF/ 7L6JfeGh/kxlj/wMevvWSSmhmeu9wHSUr00Ceavj8kMCgcuxAE+Z6IGvDpGPYpsU 7o= Received: (qmail 44536 invoked by alias); 25 May 2018 08:08:24 -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 44377 invoked by uid 89); 25 May 2018 08:08:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=LR_REGNUM, lr_regnum X-HELO: mx07-00178001.pphosted.com Received: from mx08-00178001.pphosted.com (HELO mx07-00178001.pphosted.com) (91.207.212.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 May 2018 08:08:17 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w4P7xHBj010097; Fri, 25 May 2018 10:08:14 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2j59j8k6ge-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 25 May 2018 10:08:14 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 23F2658; Fri, 25 May 2018 08:08:13 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CB75723E3; Fri, 25 May 2018 08:08:12 +0000 (GMT) Received: from gnb.st.com (10.75.127.51) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 25 May 2018 10:08:12 +0200 From: Christophe Lyon To: , Subject: [ARM/FDPIC 12/21] [ARM] FDPIC: Restore r9 after we call __aeabi_read_tp Date: Fri, 25 May 2018 10:03:25 +0200 Message-ID: <20180525080354.13295-13-christophe.lyon@st.com> In-Reply-To: <20180525080354.13295-1-christophe.lyon@st.com> References: <20180525080354.13295-1-christophe.lyon@st.com> MIME-Version: 1.0 X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG5NODE1.st.com (10.75.127.13) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-25_03:, , signatures=0 X-IsSubscribed: yes 2018-XX-XX Christophe Lyon Mickaël Guêné gcc/ * config/arm/arm.c (arm_load_tp): Add FDPIC support. * config/arm/arm.md (load_tp_soft_fdpic): New pattern. (load_tp_soft): Disable in FDPIC mode. Change-Id: I0a2e3466c9afb869ad8e844083ad178de014658e -- 2.6.3 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 20b8f66..80fe96f 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -8660,7 +8660,27 @@ arm_load_tp (rtx target) rtx tmp; - emit_insn (gen_load_tp_soft ()); + if (TARGET_FDPIC) + { + rtx par = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (3)); + + emit_insn (gen_load_tp_soft_fdpic ()); + + /* Restore r9. */ + XVECEXP (par, 0, 0) + = gen_rtx_UNSPEC (VOIDmode, + gen_rtvec (2, gen_rtx_REG (Pmode, 9), + get_hard_reg_initial_val (Pmode, 9)), + UNSPEC_PIC_RESTORE); + XVECEXP (par, 0, 1) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, 9)); + XVECEXP (par, 0, 2) + = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, 9)); + emit_insn (par); + } + else + { + emit_insn (gen_load_tp_soft ()); + } tmp = gen_rtx_REG (SImode, R0_REGNUM); emit_move_insn (target, tmp); diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 78c236c..0bd0a6b 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -11482,12 +11482,24 @@ ) ;; Doesn't clobber R1-R3. Must use r0 for the first operand. +(define_insn "load_tp_soft_fdpic" + [(set (reg:SI 0) (unspec:SI [(const_int 0)] UNSPEC_TLS)) + (clobber (reg:SI 9)) + (clobber (reg:SI LR_REGNUM)) + (clobber (reg:SI IP_REGNUM)) + (clobber (reg:CC CC_REGNUM))] + "TARGET_SOFT_TP && TARGET_FDPIC" + "bl\\t__aeabi_read_tp\\t@ load_tp_soft" + [(set_attr "conds" "clob")] +) + +;; Doesn't clobber R1-R3. Must use r0 for the first operand. (define_insn "load_tp_soft" [(set (reg:SI 0) (unspec:SI [(const_int 0)] UNSPEC_TLS)) (clobber (reg:SI LR_REGNUM)) (clobber (reg:SI IP_REGNUM)) (clobber (reg:CC CC_REGNUM))] - "TARGET_SOFT_TP" + "TARGET_SOFT_TP && !TARGET_FDPIC" "bl\\t__aeabi_read_tp\\t@ load_tp_soft" [(set_attr "conds" "clob") (set_attr "type" "branch")]