Home | History | Annotate | Line # | Download | only in arc
      1 ; newlib tls glue code for Synopsys DesignWare ARC cpu.
      2 
      3 /* Copyright (C) 2016-2022 Free Software Foundation, Inc.
      4    Contributor: Joern Rennecke <joern.rennecke (at) embecosm.com>
      5 		on behalf of Synopsys Inc.
      6 
      7 This file is part of GCC.
      8 
      9 GCC is free software; you can redistribute it and/or modify it under
     10 the terms of the GNU General Public License as published by the Free
     11 Software Foundation; either version 3, or (at your option) any later
     12 version.
     13 
     14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
     15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
     16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     17 for more details.
     18 
     19 Under Section 7 of GPL version 3, you are granted additional
     20 permissions described in the GCC Runtime Library Exception, version
     21 3.1, as published by the Free Software Foundation.
     22 
     23 You should have received a copy of the GNU General Public License and
     24 a copy of the GCC Runtime Library Exception along with this program;
     25 see 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 #ifdef __ARC_RF16__
     37 	/* Use object attributes to inform other tools this file is
     38 	safe for RF16 configuration.  */
     39 	.arc_attribute Tag_ARC_ABI_rf16, 1
     40 #endif
     41 
     42 #if (__ARC_TLS_REGNO__ != -1)
     43  /* ANSI concatenation macros.  */
     44 
     45 #define CONCAT1(a, b) CONCAT2(a, b)
     46 #define CONCAT2(a, b) a ## b
     47 
     48  /* Use the right prefix for global labels.  */
     49 
     50 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
     51 
     52 #define FUNC(X)         .type SYM(X),@function
     53 #define ENDFUNC0(X)     .Lfe_##X: .size X,.Lfe_##X-X
     54 #define ENDFUNC(X)      ENDFUNC0(X)
     55 
     56 	.global SYM(__read_tp)
     57 SYM(__read_tp):
     58 	FUNC(__read_tp)
     59 	mov r0, CONCAT1 (r, __ARC_TLS_REGNO__)
     60 	nop
     61 	j [blink]
     62 	ENDFUNC(__read_tp)
     63 
     64 	.section .init
     65 	mov CONCAT1 (r, __ARC_TLS_REGNO__),__main_tcb_end+256
     66 
     67 	.section .tbss
     68 __main_tcb:
     69 	.long 0
     70 	.long 0
     71 __main_tcb_end:
     72 
     73 #endif /*__ARC_TLS_REGNO__ != -1 */
     74