]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/elf/Mips/tls-3-micro.test
Vendor import of lld trunk r233088:
[FreeBSD/FreeBSD.git] / test / elf / Mips / tls-3-micro.test
1 # Check handling of R_MICROMIPS_TLS_GOTTPREL and R_MICROMIPS_TLS_GD relocations
2 # and generation of corresponding dynamic relocations R_MIPS_TLS_TPREL32,
3 # R_MIPS_TLS_DTPMOD32 and R_MIPS_TLS_DTPREL32 in case of executable linking.
4
5 # Create a shared library with thread symbol D1.
6 # RUN: yaml2obj -format=elf -docnum 1 -o %t-so.o %s
7 # RUN: lld -flavor gnu -target mipsel -shared -o %t.so %t-so.o
8
9 # Create executable file linked using two object files and the shared library.
10 # The object files defines thread symbols D0 and D2.
11 # RUN: yaml2obj -format=elf -docnum 2 -o %t-o1.o %s
12 # RUN: yaml2obj -format=elf -docnum 3 -o %t-o2.o %s
13 # RUN: lld -flavor gnu -target mipsel -e T0 -o %t.exe %t-o1.o %t-o2.o %t.so
14
15 # Check dynamic relocations and GOT in the executable file.
16 # RUN: llvm-readobj -r %t.exe | FileCheck -check-prefix=REL %s
17 # RUN: llvm-readobj -dynamic-table %t.exe | FileCheck -check-prefix=DYN %s
18 # RUN: llvm-readobj -dt %t.exe | FileCheck -check-prefix=SYM %s
19 # RUN: llvm-objdump -s %t.exe | FileCheck -check-prefix=GOT %s
20
21 # REL:      Section (5) .rel.dyn {
22 # REL-NEXT:   0x402008 R_MIPS_TLS_TPREL32 D1 0x0
23 # REL-NEXT:   0x40200C R_MIPS_TLS_TPREL32 D2 0x0
24 # REL-NEXT: }
25
26 # DYN: 0x7000000A MIPS_LOCAL_GOTNO 2
27 # DYN: 0x70000013 MIPS_GOTSYM      0x3
28
29 # SYM: Name: D2@ (1)
30 # SYM: Name: D1@ (4)
31
32 # GOT:      Contents of section .got:
33 # GOT-NEXT:  402000 00000000 00000080 00000000 00000000  ................
34
35 # so.o
36 ---
37 FileHeader:
38   Class:           ELFCLASS32
39   Data:            ELFDATA2LSB
40   OSABI:           ELFOSABI_GNU
41   Type:            ET_REL
42   Machine:         EM_MIPS
43   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_PIC, EF_MIPS_CPIC,
44                      EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
45 Sections:
46   - Name:            .text
47     Type:            SHT_PROGBITS
48     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
49     AddressAlign:    0x04
50     Size:            0x04
51   - Name:            .rel.text
52     Type:            SHT_REL
53     Link:            .symtab
54     Info:            .text
55     AddressAlign:    0x04
56     Relocations:
57       - Offset:          0x00
58         Symbol:          D1
59         Type:            R_MICROMIPS_TLS_GD
60   - Name:            .tdata
61     Type:            SHT_PROGBITS
62     Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
63     AddressAlign:    0x04
64     Size:            0x04
65
66 Symbols:
67   Global:
68     - Name:            T1
69       Type:            STT_FUNC
70       Section:         .text
71       Size:            0x04
72       Other:           [ STO_MIPS_MICROMIPS ]
73     - Name:            D1
74       Type:            STT_TLS
75       Section:         .tdata
76       Size:            0x04
77
78 # o1.o
79 ---
80 FileHeader:
81   Class:           ELFCLASS32
82   Data:            ELFDATA2LSB
83   OSABI:           ELFOSABI_GNU
84   Type:            ET_REL
85   Machine:         EM_MIPS
86   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
87                      EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
88 Sections:
89   - Name:            .text
90     Type:            SHT_PROGBITS
91     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
92     AddressAlign:    0x04
93     Size:            0x08
94   - Name:            .rel.text
95     Type:            SHT_REL
96     Link:            .symtab
97     Info:            .text
98     AddressAlign:    0x04
99     Relocations:
100       - Offset:          0x00
101         Symbol:          D2
102         Type:            R_MICROMIPS_TLS_TPREL_HI16
103       - Offset:          0x04
104         Symbol:          D2
105         Type:            R_MICROMIPS_TLS_TPREL_LO16
106   - Name:            .tdata
107     Type:            SHT_PROGBITS
108     Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
109     AddressAlign:    0x04
110     Size:            0x04
111
112 Symbols:
113   Global:
114     - Name:            T2
115       Type:            STT_FUNC
116       Section:         .text
117       Size:            0x08
118       Other:           [ STO_MIPS_MICROMIPS ]
119     - Name:            D2
120       Type:            STT_TLS
121       Section:         .tdata
122       Size:            0x04
123
124 # o2.o
125 ---
126 FileHeader:
127   Class:           ELFCLASS32
128   Data:            ELFDATA2LSB
129   OSABI:           ELFOSABI_GNU
130   Type:            ET_REL
131   Machine:         EM_MIPS
132   Flags:           [ EF_MIPS_NOREORDER, EF_MIPS_CPIC,
133                      EF_MIPS_ABI_O32, EF_MIPS_ARCH_32R2, EF_MIPS_MICROMIPS ]
134 Sections:
135   - Name:            .text
136     Type:            SHT_PROGBITS
137     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
138     AddressAlign:    0x04
139     Size:            0x10
140   - Name:            .rel.text
141     Type:            SHT_REL
142     Link:            .symtab
143     Info:            .text
144     AddressAlign:    0x04
145     Relocations:
146       - Offset:          0x00
147         Symbol:          D1
148         Type:            R_MICROMIPS_TLS_GOTTPREL
149         Addend:          0
150       - Offset:          0x04
151         Symbol:          D0
152         Type:            R_MICROMIPS_TLS_TPREL_HI16
153         Addend:          0
154       - Offset:          0x08
155         Symbol:          D0
156         Type:            R_MICROMIPS_TLS_TPREL_LO16
157         Addend:          0
158       - Offset:          0x0C
159         Symbol:          D2
160         Type:            R_MICROMIPS_TLS_GOTTPREL
161         Addend:          0
162   - Name:            .tdata
163     Type:            SHT_PROGBITS
164     Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
165     AddressAlign:    0x04
166     Size:            0x04
167
168 Symbols:
169   Global:
170     - Name:            D0
171       Type:            STT_TLS
172       Section:         .tdata
173       Size:            0x04
174     - Name:            T0
175       Type:            STT_FUNC
176       Section:         .text
177       Size:            0x10
178       Other:           [ STO_MIPS_MICROMIPS ]
179     - Name:            D1
180       Type:            STT_TLS
181     - Name:            D2
182       Type:            STT_TLS
183 ...