From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6592 invoked by alias); 9 Feb 2012 04:35:26 -0000 Received: (qmail 6584 invoked by uid 22791); 9 Feb 2012 04:35:24 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qy0-f169.google.com (HELO mail-qy0-f169.google.com) (209.85.216.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 04:35:11 +0000 Received: by qcsd16 with SMTP id d16so864407qcs.0 for ; Wed, 08 Feb 2012 20:35:10 -0800 (PST) Received: by 10.229.135.149 with SMTP id n21mr115826qct.85.1328761763785; Wed, 08 Feb 2012 20:29:23 -0800 (PST) Received: from anchor.twiddle.home.com ([173.160.232.49]) by mx.google.com with ESMTPS id gd3sm3337362qab.6.2012.02.08.20.29.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Feb 2012 20:29:23 -0800 (PST) From: Richard Henderson To: libc-ports@sourceware.org Subject: [PATCH 09/10] alpha: Add tls-macros.h. Date: Thu, 09 Feb 2012 04:35:00 -0000 Message-Id: <1328761745-24481-10-git-send-email-rth@twiddle.net> In-Reply-To: <1328761745-24481-1-git-send-email-rth@twiddle.net> References: <1328761745-24481-1-git-send-email-rth@twiddle.net> X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00017.txt.bz2 --- ChangeLog.alpha | 2 ++ sysdeps/alpha/tls-macros.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-) create mode 100644 sysdeps/alpha/tls-macros.h diff --git a/ChangeLog.alpha b/ChangeLog.alpha index 8ade582..804dd64 100644 --- a/ChangeLog.alpha +++ b/ChangeLog.alpha @@ -1,5 +1,7 @@ 2012-02-08 Richard Henderson + * sysdeps/alpha/tls-macros.h: New file. + * sysdeps/unix/sysv/linux/alpha/getitimer.S: Don't check HAVE_ELF. * sysdeps/unix/sysv/linux/alpha/getrusage.S: Likewise. * sysdeps/unix/sysv/linux/alpha/gettimeofday.S: Likewise. diff --git a/sysdeps/alpha/tls-macros.h b/sysdeps/alpha/tls-macros.h new file mode 100644 index 0000000..0385d93 --- /dev/null +++ b/sysdeps/alpha/tls-macros.h @@ -0,0 +1,25 @@ +/* Macros to support TLS testing in times of missing compiler support. */ + +extern void *__tls_get_addr (void *); + +# define TLS_GD(x) \ + ({ void *__result; \ + asm ("lda %0, " #x "($gp) !tlsgd" : "=r" (__result)); \ + __tls_get_addr (__result); }) + +# define TLS_LD(x) \ + ({ void *__result; \ + asm ("lda %0, " #x "($gp) !tlsldm" : "=r" (__result)); \ + __result = __tls_get_addr (__result); \ + asm ("lda %0, " #x "(%0) !dtprel" : "+r" (__result)); \ + __result; }) + +# define TLS_IE(x) \ + ({ long ofs; \ + asm ("ldq %0, " #x "($gp) !gottprel" : "=r"(ofs)); \ + __builtin_thread_pointer () + ofs; }) + +# define TLS_LE(x) \ + ({ void *__result = __builtin_thread_pointer (); \ + asm ("lda %0, " #x "(%0) !tprel" : "+r" (__result)); \ + __result; }) -- 1.7.7.6