1 /* Copyright (C) 2009-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #define TLS_LD(x) TLS_GD(x)
22 ({ register unsigned long __result asm ("x0"); \
23 asm ("adrp %0, :tlsgd:" #x "; " \
24 "add %0, %0, #:tlsgd_lo12:" #x "; " \
25 "bl __tls_get_addr;" \
29 : "x1", "x2", "x3", "x4", "x5", "x6", \
30 "x7", "x8", "x9", "x10", "x11", "x12", \
31 "x13", "x14", "x15", "x16", "x17", "x18", \
32 "x30", "memory", "cc"); \
33 (int *) (__result); })
36 ({ register unsigned long __result asm ("x0"); \
37 register unsigned long __t; \
38 asm ("mrs %1, tpidr_el0; " \
39 "adrp %0, :gottprel:" #x "; " \
40 "ldr %0, [%0, #:gottprel_lo12:" #x "]; " \
42 : "=r" (__result), "=r" (__t)); \
43 (int *) (__result); })
46 ({ register unsigned long __result asm ("x0"); \
47 asm ("mrs %0, tpidr_el0; " \
48 "add %0, %0, :tprel_hi12:" #x "; " \
49 "add %0, %0, :tprel_lo12_nc:" #x \
51 (int *) (__result); })