summaryrefslogtreecommitdiffstats
path: root/lld/test/old-elf/tls-tbss-size.test
blob: a7fd86cb7b432582e55128d5e1da48a1abc8b876 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# This test verify if external TLS non initialized variables (tbss) are
# accounted in TBSS segment size

# The input file 'test/elf/Inputs/tls-tbss-size.yaml' declares:
#
# __thread int t0;       
# __thread int t1;
# __thread int t2;
# __thread int t3;        
#
# And the 'test/elf/tls-tbss-size.test' defines: 
#
# __thread int t4;                                                                          
# __thread int t5;
# __thread int t6;             
# __thread int t7;
#
# __thread int t8 = 3;                 
# __thread int t9 = 4;    
# __thread int t10 = 5;
# __thread int t11 = 6;                    

#RUN: yaml2obj -format=elf -o=%t-t1.o %p/Inputs/tls-tbss-size.yaml
#RUN: yaml2obj -format=elf -o=%t-t0.o %s
#RUN: lld -flavor old-gnu -target x86_64-linux --noinhibit-exec -o %t.exe %t-t0.o %t-t1.o
#RUN: llvm-readobj --sections %t.exe | FileCheck %s
                                          
#CHECK: Sections [
#CHECK:   Section {
#CHECK:     Index: 9
#CHECK:     Name: .tdata (71)
#CHECK:     Size: 16
#CHECK:   } 
#CHECK:   Section {
#CHECK:     Index: 10
#CHECK:     Name: .tbss (78)
#CHECK:     Size: 32
#CHECK:   }

---
FileHeader:      
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  OSABI:           ELFOSABI_GNU
  Type:            ET_REL
  Machine:         EM_X86_64
Sections:        
  - Name:            .text
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
    AddressAlign:    0x0000000000000010
    Content:         488B050000000064C70001000000488B050000000064C70002000000488B050000000064C70003000000488B050000000064C7000400000064C70425000000000500000064C70425000000000600000064C70425000000000700000064C70425000000000800000031C0C3
  - Name:            .rela.text
    Type:            SHT_RELA
    Link:            .symtab
    AddressAlign:    0x0000000000000008
    Info:            .text
    Relocations:     
      - Offset:          0x0000000000000003
        Symbol:          t0
        Type:            R_X86_64_GOTTPOFF
        Addend:          -4
      - Offset:          0x0000000000000011
        Symbol:          t1
        Type:            R_X86_64_GOTTPOFF
        Addend:          -4
      - Offset:          0x000000000000001F
        Symbol:          t2
        Type:            R_X86_64_GOTTPOFF
        Addend:          -4
      - Offset:          0x000000000000002D
        Symbol:          t3
        Type:            R_X86_64_GOTTPOFF
        Addend:          -4
      - Offset:          0x000000000000003C
        Symbol:          t4
        Type:            R_X86_64_TPOFF32
      - Offset:          0x0000000000000048
        Symbol:          t5
        Type:            R_X86_64_TPOFF32
      - Offset:          0x0000000000000054
        Symbol:          t6
        Type:            R_X86_64_TPOFF32
      - Offset:          0x0000000000000060
        Symbol:          t7
        Type:            R_X86_64_TPOFF32
  - Name:            .data
    Type:            SHT_PROGBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    AddressAlign:    0x0000000000000004
    Content:         ''
  - Name:            .bss
    Type:            SHT_NOBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC ]
    AddressAlign:    0x0000000000000004
  - Name:            .tdata
    Type:            SHT_PROGBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
    AddressAlign:    0x0000000000000004
    Content:         '03000000040000000500000006000000'
  - Name:            .tbss
    Type:            SHT_NOBITS
    Flags:           [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
    AddressAlign:    0x0000000000000004
    Size:            16
  - Name:            .note.GNU-stack
    Type:            SHT_PROGBITS
    AddressAlign:    0x0000000000000001
    Content:         ''
  - Name:            .eh_frame
    Type:            SHT_PROGBITS
    Flags:           [ SHF_ALLOC ]
    AddressAlign:    0x0000000000000008
    Content:         1400000000000000017A5200017810011B0C070890010000140000001C000000000000006B0000000000000000000000
Symbols:         
  Local:           
    - Name:            .tbss
      Type:            STT_TLS
      Section:         .tbss
    - Name:            .tdata
      Type:            STT_TLS
      Section:         .tdata
    - Type:            STT_SECTION
      Section:         .text
  Global:          
    - Name:            main
      Type:            STT_FUNC
      Section:         .text
      Size:            0x000000000000006B
    - Name:            t0
      Type:            STT_TLS
    - Name:            t1
      Type:            STT_TLS
    - Name:            t10
      Type:            STT_TLS
      Section:         .tdata
      Value:           0x0000000000000008
      Size:            0x0000000000000004
    - Name:            t11
      Type:            STT_TLS
      Section:         .tdata
      Value:           0x000000000000000C
      Size:            0x0000000000000004
    - Name:            t2
      Type:            STT_TLS
    - Name:            t3
      Type:            STT_TLS
    - Name:            t4
      Type:            STT_TLS
      Section:         .tbss
      Size:            0x0000000000000004
    - Name:            t5
      Type:            STT_TLS
      Section:         .tbss
      Value:           0x0000000000000004
      Size:            0x0000000000000004
    - Name:            t6
      Type:            STT_TLS
      Section:         .tbss
      Value:           0x0000000000000008
      Size:            0x0000000000000004
    - Name:            t7
      Type:            STT_TLS
      Section:         .tbss
      Value:           0x000000000000000C
      Size:            0x0000000000000004
    - Name:            t8
      Type:            STT_TLS
      Section:         .tdata
      Size:            0x0000000000000004
    - Name:            t9
      Type:            STT_TLS
      Section:         .tdata
      Value:           0x0000000000000004
      Size:            0x0000000000000004
...
OpenPOWER on IntegriCloud