1; newlib tls glue code for Synopsys DesignWare ARC cpu.
2
3/* Copyright (C) 2016-2019 Free Software Foundation, Inc.
4   Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
5		on behalf of Synopsys Inc.
6
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 3, or (at your option) any later
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17for more details.
18
19Under Section 7 of GPL version 3, you are granted additional
20permissions described in the GCC Runtime Library Exception, version
213.1, as published by the Free Software Foundation.
22
23You should have received a copy of the GNU General Public License and
24a copy of the GCC Runtime Library Exception along with this program;
25see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
26<http://www.gnu.org/licenses/>.  */
27
28/* As a special exception, if you link this library with other files,
29   some of which are compiled with GCC, to produce an executable,
30   this library does not by itself cause the resulting executable
31   to be covered by the GNU General Public License.
32   This exception does not however invalidate any other reasons why
33   the executable file might be covered by the GNU General Public License.  */
34
35
36#if (__ARC_TLS_REGNO__ != -1)
37 /* ANSI concatenation macros.  */
38
39#define CONCAT1(a, b) CONCAT2(a, b)
40#define CONCAT2(a, b) a ## b
41
42 /* Use the right prefix for global labels.  */
43
44#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
45
46#define FUNC(X)         .type SYM(X),@function
47#define ENDFUNC0(X)     .Lfe_##X: .size X,.Lfe_##X-X
48#define ENDFUNC(X)      ENDFUNC0(X)
49
50	.global SYM(__read_tp)
51SYM(__read_tp):
52	FUNC(__read_tp)
53	mov r0, CONCAT1 (r, __ARC_TLS_REGNO__)
54	nop
55	j [blink]
56	ENDFUNC(__read_tp)
57
58	.section .init
59	mov CONCAT1 (r, __ARC_TLS_REGNO__),__main_tcb_end+256
60
61	.section .tbss
62__main_tcb:
63	.long 0
64	.long 0
65__main_tcb_end:
66
67#endif /*__ARC_TLS_REGNO__ != -1 */
68