From patchwork Mon Mar 19 18:42:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 887832 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=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91165-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Y+XSmCLZ"; 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 404lL330dbz9s7f for ; Tue, 20 Mar 2018 05:42:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=j+H1X21ef9CKdx1GqPpaZz6DOWiQPfCufsWZI+JKdTZeMbv3epiGF qduUgxGlOWvpl3PP9X6FmtySIBn7CDdssV0wODvemug5KHLOp2LntTisb3+y3+mZ tFPEsHz8vDRT5uMAbhl1Xx7Nl2/fDxpDM+xpBDLmtqeelAXZGEDF7E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=w19ZPYxmFLz3cjPHUyx+6LQ46fU=; b=Y+XSmCLZvDsjyvh/H8VN7nMnkW/T NfGr26e5R5wdWkfJw1hD+jryms7pp32gwG9ED6qT0pvsUsMShGp4dLckrkRxXjpw a1L7ahqnx2VrXvn+ZVxBQ3afjkZBOS5IzZVAKILtJtBZgTIoZEVQy4xZz6ujpVlB 3bswlcMfOUxaQss= Received: (qmail 76628 invoked by alias); 19 Mar 2018 18:42:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76603 invoked by uid 89); 19 Mar 2018 18:42:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1756, H*r:bc8, H*RU:bc8, Hx-spam-relays-external:bc8 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: DJ Delorie Subject: [2.27 COMMITTED 1/3] RISC-V: Do not initialize $gp in TLS macros. Date: Mon, 19 Mar 2018 19:42:06 +0100 Message-Id: <20180319184208.23770-1-aurelien@aurel32.net> From: DJ Delorie RISC-V TLS doesn't require GP to be initialized, and doing so breaks TLS in a shared object. (cherry picked from commit 8090720a87e42fddc31396f6126112d4b8014d8e) --- ChangeLog | 4 ++++ sysdeps/riscv/tls-macros.h | 20 +++----------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17075925fa6..8b859f637d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-02-22 DJ Delorie + + * sysdeps/riscv/tls-macros.h: Do not initialize $gp. + 2018-03-16 Rafal Luzynski [BZ #22963] diff --git a/sysdeps/riscv/tls-macros.h b/sysdeps/riscv/tls-macros.h index 5433ed9d16c..7f0dd926d0c 100644 --- a/sysdeps/riscv/tls-macros.h +++ b/sysdeps/riscv/tls-macros.h @@ -23,19 +23,9 @@ #include #include "dl-tls.h" -#define LOAD_GP \ - ".option push\n\t" \ - ".option norelax\n\t" \ - "la gp, __global_pointer$\n\t" \ - ".option pop\n\t" - -#define UNLOAD_GP - #define TLS_GD(x) \ ({ void *__result; \ - asm (LOAD_GP \ - "la.tls.gd %0, " #x "\n\t" \ - UNLOAD_GP \ + asm ("la.tls.gd %0, " #x "\n\t" \ : "=r" (__result)); \ __tls_get_addr (__result); }) @@ -43,19 +33,15 @@ #define TLS_IE(x) \ ({ void *__result; \ - asm (LOAD_GP \ - "la.tls.ie %0, " #x "\n\t" \ + asm ("la.tls.ie %0, " #x "\n\t" \ "add %0, %0, tp\n\t" \ - UNLOAD_GP \ : "=r" (__result)); \ __result; }) #define TLS_LE(x) \ ({ void *__result; \ - asm (LOAD_GP \ - "lui %0, %%tprel_hi(" #x ")\n\t" \ + asm ("lui %0, %%tprel_hi(" #x ")\n\t" \ "add %0, %0, tp, %%tprel_add(" #x ")\n\t" \ "addi %0, %0, %%tprel_lo(" #x ")\n\t" \ - UNLOAD_GP \ : "=r" (__result)); \ __result; })