1 #include <sysdep.h> /* For ARCH_HAS_T2. */
4 # define ARM_PC_OFFSET "4"
6 # define ARM_PC_OFFSET "8"
9 /* Returns the address of data containing ".word SYMBOL(RELOC)". */
10 #if defined (ARCH_HAS_T2) && !defined (PIC)
11 # define GET_SPECIAL_RELOC(symbol, reloc) \
13 int *__##symbol##_rodata; \
14 asm ("movw %0, #:lower16:1f\n" \
15 "movt %0, #:upper16:1f\n" \
16 ".pushsection .rodata.cst4, \"aM\", %%progbits, 4\n" \
18 "1: .word " #symbol "(" #reloc ")\n" \
20 : "=r" (__##symbol##_rodata)); \
21 __##symbol##_rodata; \
23 #elif defined (ARCH_HAS_T2) && defined (PIC) && ARM_PCREL_MOVW_OK
24 # define GET_SPECIAL_RELOC(symbol, reloc) \
26 int *__##symbol##_rodata; \
27 asm ("movw %0, #:lower16:1f - 2f - " ARM_PC_OFFSET "\n" \
28 "movt %0, #:upper16:1f - 2f - " ARM_PC_OFFSET "\n" \
29 ".pushsection .rodata.cst4, \"aM\", %%progbits, 4\n" \
31 "1: .word " #symbol "(" #reloc ")\n" \
34 : "=r" (__##symbol##_rodata)); \
35 __##symbol##_rodata; \
38 # define GET_SPECIAL_RELOC(symbol, reloc) \
40 int *__##symbol##_rodata; \
44 "1: .word " #symbol "(" #reloc ")\n" \
46 : "=r" (__##symbol##_rodata)); \
47 __##symbol##_rodata; \
51 /* Returns the pointer value (SYMBOL(RELOC) + pc - PC_OFS). */
52 #define GET_SPECIAL_PCREL(symbol, reloc) \
54 int *__##symbol##_rodata = GET_SPECIAL_RELOC (symbol, reloc); \
55 (void *) ((int) __##symbol##_rodata + *__##symbol##_rodata); \
59 (__builtin_thread_pointer () + *GET_SPECIAL_RELOC (x, tpoff))
62 ((int *) (__builtin_thread_pointer () \
63 + *(int *) GET_SPECIAL_PCREL (x, gottpoff)))
65 extern void *__tls_get_addr (void *);
68 ((int *) (__tls_get_addr (GET_SPECIAL_PCREL (x, tlsldm)) \
69 + *GET_SPECIAL_RELOC (x, tlsldo)))
72 ((int *) __tls_get_addr (GET_SPECIAL_PCREL (x, tlsgd)))