From patchwork Tue Feb 20 02:54:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 875385 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-90384-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="TgNE9Dew"; 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 3zllb910W3z9ryg for ; Tue, 20 Feb 2018 13:55:00 +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:date:message-id:from:to:subject; q=dns; s= default; b=PfH/i12MKZ2+K3nZ3hjEvpknISsfcWFMksgatx68h9g50TFYKo/tq xY3+XhKAZJwxy6QLV+WbaTmpUcQotFRtLlR+fWsw+1p0CB7DYZCyIJKftEz7/sRd +LSJSz+Y3rqI+zBu6v6btcFQU85FZG5Gne7EFK1sK3DlziyzOkJ1P0= 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:date:message-id:from:to:subject; s=default; bh=23UZyz7QfcseWPVXrYjqHeAW5m4=; b=TgNE9Dewvcmr+ggX/W0nTIE1VJYz YcGeMSyD7hqlVanpJb+OwNJLYuJ/rHpmbVDBTAeDa16EhKoo1oHYtKiTEEpr4ioP oQeehmLQfn2/3RIszwAbq1Xf284VZusthG79FS3WaHfZqBDyG8Y/z2Qj8eaMumtM 9AA9qNDixM5QQx0= Received: (qmail 92588 invoked by alias); 20 Feb 2018 02:54:55 -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 92578 invoked by uid 89); 20 Feb 2018 02:54:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=2319, 3315, UD:gd, UD:ie X-HELO: mx1.redhat.com Date: Mon, 19 Feb 2018 21:54:49 -0500 Message-Id: From: DJ Delorie To: libc-alpha@sourceware.org Subject: riscv: TLS init fix RISC-V TLS doesn't require GP to be initialized, and doing so breaks TLS in a shared object. diff --git a/sysdeps/riscv/tls-macros.h b/sysdeps/riscv/tls-macros.h index 5433ed9d16..7f0dd926d0 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; })