From patchwork Fri Nov 18 05:30:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hurugalawadi, Naveen" X-Patchwork-Id: 82831 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1165454qge; Thu, 17 Nov 2016 21:31:17 -0800 (PST) X-Received: by 10.13.221.146 with SMTP id g140mr5790717ywe.356.1479447077696; Thu, 17 Nov 2016 21:31:17 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g65si1077942ywh.394.2016.11.17.21.31.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 21:31:17 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441897-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; spf=pass (google.com: domain of gcc-patches-return-441897-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441897-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:cc:subject:date:message-id:content-type:mime-version; q=dns; s=default; b=wkJU6yclAdzPmbw3GxzzW5WAwYDrGbsA1Ibe4lJGoDb191WCl7 QSbj33k/bG4MLVm88xBtAY18ayCUuEWaidz2fRlZW4yUrNX+CONsx+LYcJQxdFqI +LUr4t3YVKQLSRMd2Lr90nedYwvA/YLBAQvR30z0znzzvuiP4osGQczPw= 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:cc:subject:date:message-id:content-type:mime-version; s= default; bh=u1RF2rbUFCXdf+noHpuyh52CdRc=; b=KFmXAqPPGSXKJe4n6UOA n5bF92FFN9k3/Ha3zHM+uyGGyv+983KI91mYzXEplBCM14K7FmWmg51/drdKwDYf v7MUaINF3GQnT21wUFsh5/milGQbx6Ce0OUs587/KzYCZjG4dhmcWMumZCovlI5r J0SL+3gMlnmW6Biv7COCdDA= Received: (qmail 17005 invoked by alias); 18 Nov 2016 05:30:58 -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 16919 invoked by uid 89); 18 Nov 2016 05:30:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Hx-exchange-antispam-report-cfa-test:102415395, HS, hs, 2016-11-18 X-HELO: NAM03-BY2-obe.outbound.protection.outlook.com Received: from mail-by2nam03on0079.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) (104.47.42.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 18 Nov 2016 05:30:27 +0000 Received: from CO2PR07MB2694.namprd07.prod.outlook.com (10.166.214.7) by CO2PR07MB2695.namprd07.prod.outlook.com (10.166.214.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10; Fri, 18 Nov 2016 05:30:22 +0000 Received: from CO2PR07MB2694.namprd07.prod.outlook.com ([10.166.214.7]) by CO2PR07MB2694.namprd07.prod.outlook.com ([10.166.214.7]) with mapi id 15.01.0721.017; Fri, 18 Nov 2016 05:30:22 +0000 From: "Hurugalawadi, Naveen" To: "gcc-patches@gcc.gnu.org" CC: Marcus Shawcroft , Richard Earnshaw , Kyrill Tkachov Subject: [PATCH] [AArch64] Fix PR78382 Date: Fri, 18 Nov 2016 05:30:22 +0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Naveen.Hurugalawadi@cavium.com; x-microsoft-exchange-diagnostics: 1; CO2PR07MB2695; 7:ZJEbYfF9mgklcHhiMBntBiH+69/IXNi8fEfthdQppViHh/vTIPA9ZGKWoBGIk7wc9L5AJBTmZaQD5g8/qog7EFDs71dAYOCUE3743wdBFYKLJn3kRkkEn+K0Y0RyMI/rasXQaX2cCk4C/z4ADocjQYI7wQ1k6QVT2w5gJBkbpjMnbymONsD4r1FS9eACpZMOzj5dzS00rSc6xGfsgD7IskUpDt9emgQ6lGxigPkOw5+cfslmwbtzF2b4JFeL3OOQiOtPUKwsPfJSH6W4d4Y4ylZ2CS4QAX6C1TEJVL+8Wj2aaZbUrfTWqMg4uxykhbCZeEwJF91IS8jEKv3R23np2M1EqBlGFI72eLA9wjuMFQE= x-ms-office365-filtering-correlation-id: aca0fd1e-710b-4ae7-561a-08d40f73fdec x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CO2PR07MB2695; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(102415395)(6060326)(6040281)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041223)(6061324); SRVR:CO2PR07MB2695; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2695; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(189002)(377424004)(199003)(66066001)(110136003)(2351001)(8676002)(8936002)(76576001)(33656002)(4326007)(99286002)(99936001)(122556002)(68736007)(6116002)(6506003)(2501003)(5890100001)(3846002)(102836003)(81156014)(81166006)(2906002)(86362001)(9686002)(87936001)(2900100001)(54356999)(3280700002)(7696004)(50986999)(3660700001)(189998001)(92566002)(101416001)(4001150100001)(77096005)(97736004)(305945005)(7736002)(6916009)(106356001)(105586002)(106116001)(7846002)(5660300001)(74316002); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB2695; H:CO2PR07MB2694.namprd07.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Nov 2016 05:30:22.0151 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2695 Hi, Please find attached the patch that fixes PR78382. The "SYMBOL_SMALL_TLSGD" was not handled for ILP32. Hence it generates error when compiled for ILP32. The attached patch adds the support and handles it properly as expected for ILP32. Please review the patch and let me know if its okay? Regression tested on AArch64 with no regressions. Thanks, Naveen 2016-11-18 Naveen H.S * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Handle SYMBOL_SMALL_TLSGD for ILP32. * config/aarch64/aarch64.md : tlsgd_small modified into tlsgd_small_ to support SImode and DImode. *tlsgd_small modified into *tlsgd_small_ to support SImode and DImode. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 11d41cf..1688f0d 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1374,10 +1374,17 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, case SYMBOL_SMALL_TLSGD: { rtx_insn *insns; - rtx result = gen_rtx_REG (Pmode, R0_REGNUM); + rtx result; + if (TARGET_ILP32) + result = gen_rtx_REG (SImode, R0_REGNUM); + else + result = gen_rtx_REG (DImode, R0_REGNUM); start_sequence (); - aarch64_emit_call_insn (gen_tlsgd_small (result, imm)); + if (TARGET_ILP32) + aarch64_emit_call_insn (gen_tlsgd_small_si (result, imm)); + else + aarch64_emit_call_insn (gen_tlsgd_small_di (result, imm)); insns = get_insns (); end_sequence (); diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index a652a7c..4833c7f 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -5089,20 +5089,20 @@ ;; The TLS ABI specifically requires that the compiler does not schedule ;; instructions in the TLS stubs, in order to enable linker relaxation. ;; Therefore we treat the stubs as an atomic sequence. -(define_expand "tlsgd_small" +(define_expand "tlsgd_small_" [(parallel [(set (match_operand 0 "register_operand" "") (call (mem:DI (match_dup 2)) (const_int 1))) - (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "")] UNSPEC_GOTSMALLTLS) + (unspec:DI [(match_operand:PTR 1 "aarch64_valid_symref" "")] UNSPEC_GOTSMALLTLS) (clobber (reg:DI LR_REGNUM))])] "" { operands[2] = aarch64_tls_get_addr (); }) -(define_insn "*tlsgd_small" +(define_insn "*tlsgd_small_" [(set (match_operand 0 "register_operand" "") (call (mem:DI (match_operand:DI 2 "" "")) (const_int 1))) - (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")] UNSPEC_GOTSMALLTLS) + (unspec:DI [(match_operand:PTR 1 "aarch64_valid_symref" "S")] UNSPEC_GOTSMALLTLS) (clobber (reg:DI LR_REGNUM)) ] "" diff --git a/gcc/testsuite/gcc.target/aarch64/pr78382.c b/gcc/testsuite/gcc.target/aarch64/pr78382.c new file mode 100644 index 0000000..6c98e5e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr78382.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -fpic -mabi=ilp32 -mtls-dialect=trad" } */ + +__thread int abc; +void +foo () +{ + int *p; + p = &abc; +}