xref: /llvm-project/llvm/test/tools/dsymutil/X86/tls-variable.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1f9f92f13SAlexey Lapshin## This test checks that thread local storage variables
2f9f92f13SAlexey Lapshin## are preserved.
3f9f92f13SAlexey Lapshin
4f9f92f13SAlexey Lapshin# RUN: yaml2obj %s -o %t.o
5f9f92f13SAlexey Lapshin# RUN: echo '---' > %t2.map
6f9f92f13SAlexey Lapshin# RUN: echo "triple:          'x86_64-apple-darwin'" >> %t2.map
7f9f92f13SAlexey Lapshin# RUN: echo 'objects:'  >> %t2.map
8f9f92f13SAlexey Lapshin# RUN: echo " -  filename: '%t.o'" >> %t2.map
9f9f92f13SAlexey Lapshin# RUN: echo '    symbols:' >> %t2.map
10f9f92f13SAlexey Lapshin# RUN: echo '      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }' >> %t2.map
11f9f92f13SAlexey Lapshin# RUN: echo '...' >> %t2.map
12f9f92f13SAlexey Lapshin# RUN: dsymutil -y %t2.map --keep-function-for-static -f -o - | llvm-dwarfdump -a - | FileCheck %s
13*f1fdfe68SAlexey Lapshin# RUN: dsymutil --linker parallel -y %t2.map --keep-function-for-static -f -o - | llvm-dwarfdump -a - | FileCheck %s
14f9f92f13SAlexey Lapshin
15f9f92f13SAlexey Lapshin# CHECK: file format Mach-O 64-bit x86-64
16f9f92f13SAlexey Lapshin# CHECK: .debug_info contents:
17f9f92f13SAlexey Lapshin# CHECK: Compile Unit:
18f9f92f13SAlexey Lapshin# CHECK: DW_TAG_compile_unit
19f9f92f13SAlexey Lapshin# CHECK: DW_AT_name{{.*}}"CU1"
20f9f92f13SAlexey Lapshin# CHECK: DW_TAG_subprogram
21f9f92f13SAlexey Lapshin# CHECK: DW_AT_name{{.*}}"foo"
22f9f92f13SAlexey Lapshin# CHECK: DW_TAG_variable
23f9f92f13SAlexey Lapshin# CHECK: DW_AT_name{{.*}}"var1"
24f9f92f13SAlexey Lapshin# CHECK: DW_AT_location        (DW_OP_const8u 0x{{.*}}, DW_OP_GNU_push_tls_address)
25f9f92f13SAlexey Lapshin# CHECK: DW_AT_name{{.*}}"var2"
26f9f92f13SAlexey Lapshin# CHECK: DW_AT_location        (DW_OP_const8u 0x{{.*}}, DW_OP_form_tls_address)
27f9f92f13SAlexey Lapshin
28f9f92f13SAlexey Lapshin--- !mach-o
29f9f92f13SAlexey LapshinFileHeader:
30f9f92f13SAlexey Lapshin  magic:      0xFEEDFACF
31f9f92f13SAlexey Lapshin  cputype:    0x01000007
32f9f92f13SAlexey Lapshin  cpusubtype: 0x00000003
33f9f92f13SAlexey Lapshin  filetype:   0x00000001
34f9f92f13SAlexey Lapshin  ncmds:      2
35f9f92f13SAlexey Lapshin  sizeofcmds: 376
36f9f92f13SAlexey Lapshin  flags:      0x00002000
37f9f92f13SAlexey Lapshin  reserved:   0x00000000
38f9f92f13SAlexey LapshinLoadCommands:
39f9f92f13SAlexey Lapshin  - cmd:      LC_SEGMENT_64
40f9f92f13SAlexey Lapshin    cmdsize:  232
41f9f92f13SAlexey Lapshin    segname:  ''
42f9f92f13SAlexey Lapshin    vmaddr:   0x00
43f9f92f13SAlexey Lapshin    vmsize:   0x300
44f9f92f13SAlexey Lapshin    fileoff:  0x300
45f9f92f13SAlexey Lapshin    filesize: 0x300
46f9f92f13SAlexey Lapshin    maxprot:  7
47f9f92f13SAlexey Lapshin    initprot: 7
48f9f92f13SAlexey Lapshin    nsects:   2
49f9f92f13SAlexey Lapshin    flags:    0
50f9f92f13SAlexey Lapshin    Sections:
51f9f92f13SAlexey Lapshin      - sectname:  __debug_abbrev
52f9f92f13SAlexey Lapshin        segname:   __DWARF
53f9f92f13SAlexey Lapshin        addr:      0x000000000000000F
54f9f92f13SAlexey Lapshin        size:      0x27
55f9f92f13SAlexey Lapshin        offset:    0x00000380
56f9f92f13SAlexey Lapshin        align:     0
57f9f92f13SAlexey Lapshin        reloff:    0x00000000
58f9f92f13SAlexey Lapshin        nreloc:    0
59f9f92f13SAlexey Lapshin        flags:     0x02000000
60f9f92f13SAlexey Lapshin        reserved1: 0x00000000
61f9f92f13SAlexey Lapshin        reserved2: 0x00000000
62f9f92f13SAlexey Lapshin        reserved3: 0x00000000
63f9f92f13SAlexey Lapshin      - sectname:  __debug_info
64f9f92f13SAlexey Lapshin        segname:   __DWARF
65f9f92f13SAlexey Lapshin        addr:      0x000000000000100
66f9f92f13SAlexey Lapshin        size:      0x54
67f9f92f13SAlexey Lapshin        offset:    0x00000410
68f9f92f13SAlexey Lapshin        align:     0
69f9f92f13SAlexey Lapshin        reloff:    0x00000600
70f9f92f13SAlexey Lapshin        nreloc:    2
71f9f92f13SAlexey Lapshin        flags:     0x02000000
72f9f92f13SAlexey Lapshin        reserved1: 0x00000000
73f9f92f13SAlexey Lapshin        reserved2: 0x00000000
74f9f92f13SAlexey Lapshin        reserved3: 0x00000000
75f9f92f13SAlexey Lapshin        relocations:
76f9f92f13SAlexey Lapshin          - address:         0x32
77f9f92f13SAlexey Lapshin            symbolnum:       1
78f9f92f13SAlexey Lapshin            pcrel:           true
79f9f92f13SAlexey Lapshin            length:          3
80f9f92f13SAlexey Lapshin            extern:          true
81f9f92f13SAlexey Lapshin            type:            0
82f9f92f13SAlexey Lapshin            scattered:       false
83f9f92f13SAlexey Lapshin            value:           0
84f9f92f13SAlexey Lapshin          - address:         0x47
85f9f92f13SAlexey Lapshin            symbolnum:       1
86f9f92f13SAlexey Lapshin            pcrel:           true
87f9f92f13SAlexey Lapshin            length:          3
88f9f92f13SAlexey Lapshin            extern:          true
89f9f92f13SAlexey Lapshin            type:            0
90f9f92f13SAlexey Lapshin            scattered:       false
91f9f92f13SAlexey Lapshin            value:           0
92f9f92f13SAlexey Lapshin  - cmd:             LC_SYMTAB
93f9f92f13SAlexey Lapshin    cmdsize:         24
94f9f92f13SAlexey Lapshin    symoff:          0x700
95f9f92f13SAlexey Lapshin    nsyms:           2
96f9f92f13SAlexey Lapshin    stroff:          0x720
97f9f92f13SAlexey Lapshin    strsize:         10
98f9f92f13SAlexey LapshinLinkEditData:
99f9f92f13SAlexey Lapshin  NameList:
100f9f92f13SAlexey Lapshin    - n_strx:          1
101f9f92f13SAlexey Lapshin      n_type:          0x0F
102f9f92f13SAlexey Lapshin      n_sect:          1
103f9f92f13SAlexey Lapshin      n_desc:          0
104f9f92f13SAlexey Lapshin      n_value:         0
105f9f92f13SAlexey Lapshin    - n_strx:          1
106f9f92f13SAlexey Lapshin      n_type:          0x0F
107f9f92f13SAlexey Lapshin      n_sect:          1
108f9f92f13SAlexey Lapshin      n_desc:          0
109f9f92f13SAlexey Lapshin      n_value:         0
110f9f92f13SAlexey Lapshin  StringTable:
111f9f92f13SAlexey Lapshin    - ''
112f9f92f13SAlexey Lapshin    - '__Z3foov'
113f9f92f13SAlexey Lapshin    - ''
114f9f92f13SAlexey LapshinDWARF:
115f9f92f13SAlexey Lapshin  debug_abbrev:
116f9f92f13SAlexey Lapshin    - Table:
117f9f92f13SAlexey Lapshin      - Tag:      DW_TAG_compile_unit
118f9f92f13SAlexey Lapshin        Children: DW_CHILDREN_yes
119f9f92f13SAlexey Lapshin        Attributes:
120f9f92f13SAlexey Lapshin          - Attribute: DW_AT_producer
121f9f92f13SAlexey Lapshin            Form:      DW_FORM_string
122f9f92f13SAlexey Lapshin          - Attribute: DW_AT_language
123f9f92f13SAlexey Lapshin            Form:      DW_FORM_data2
124f9f92f13SAlexey Lapshin          - Attribute: DW_AT_name
125f9f92f13SAlexey Lapshin            Form:      DW_FORM_string
126f9f92f13SAlexey Lapshin      - Tag:      DW_TAG_subprogram
127f9f92f13SAlexey Lapshin        Children: DW_CHILDREN_yes
128f9f92f13SAlexey Lapshin        Attributes:
129f9f92f13SAlexey Lapshin          - Attribute: DW_AT_name
130f9f92f13SAlexey Lapshin            Form:      DW_FORM_string
131f9f92f13SAlexey Lapshin          - Attribute: DW_AT_type
132f9f92f13SAlexey Lapshin            Form:      DW_FORM_ref4
133f9f92f13SAlexey Lapshin      - Tag:      DW_TAG_variable
134f9f92f13SAlexey Lapshin        Children: DW_CHILDREN_no
135f9f92f13SAlexey Lapshin        Attributes:
136f9f92f13SAlexey Lapshin          - Attribute: DW_AT_name
137f9f92f13SAlexey Lapshin            Form:      DW_FORM_string
138f9f92f13SAlexey Lapshin          - Attribute: DW_AT_type
139f9f92f13SAlexey Lapshin            Form:      DW_FORM_ref4
140f9f92f13SAlexey Lapshin          - Attribute: DW_AT_location
141f9f92f13SAlexey Lapshin            Form:      DW_FORM_exprloc
142f9f92f13SAlexey Lapshin      - Tag:      DW_TAG_base_type
143f9f92f13SAlexey Lapshin        Children: DW_CHILDREN_no
144f9f92f13SAlexey Lapshin        Attributes:
145f9f92f13SAlexey Lapshin          - Attribute: DW_AT_name
146f9f92f13SAlexey Lapshin            Form:      DW_FORM_string
147f9f92f13SAlexey Lapshin  debug_info:
148f9f92f13SAlexey Lapshin    - Version: 4
149f9f92f13SAlexey Lapshin      Entries:
150f9f92f13SAlexey Lapshin        - AbbrCode: 1
151f9f92f13SAlexey Lapshin          Values:
152f9f92f13SAlexey Lapshin            - CStr: by_hand
153f9f92f13SAlexey Lapshin            - Value:  0x04
154f9f92f13SAlexey Lapshin            - CStr: CU1
155f9f92f13SAlexey Lapshin        - AbbrCode: 4
156f9f92f13SAlexey Lapshin          Values:
157f9f92f13SAlexey Lapshin            - CStr: int
158f9f92f13SAlexey Lapshin        - AbbrCode: 2
159f9f92f13SAlexey Lapshin          Values:
160f9f92f13SAlexey Lapshin            - CStr: foo
161f9f92f13SAlexey Lapshin            - Value: 0x1a
162f9f92f13SAlexey Lapshin        - AbbrCode: 3
163f9f92f13SAlexey Lapshin          Values:
164f9f92f13SAlexey Lapshin            - CStr: var1
165f9f92f13SAlexey Lapshin            - Value:  0x0000001a
166f9f92f13SAlexey Lapshin            - BlockData:
167f9f92f13SAlexey Lapshin                - 0x0e
168f9f92f13SAlexey Lapshin                - 0x00
169f9f92f13SAlexey Lapshin                - 0x00
170f9f92f13SAlexey Lapshin                - 0x01
171f9f92f13SAlexey Lapshin                - 0x00
172f9f92f13SAlexey Lapshin                - 0x00
173f9f92f13SAlexey Lapshin                - 0x00
174f9f92f13SAlexey Lapshin                - 0x00
175f9f92f13SAlexey Lapshin                - 0x00
176f9f92f13SAlexey Lapshin                - 0xe0
177f9f92f13SAlexey Lapshin        - AbbrCode: 3
178f9f92f13SAlexey Lapshin          Values:
179f9f92f13SAlexey Lapshin            - CStr: var2
180f9f92f13SAlexey Lapshin            - Value:  0x0000001a
181f9f92f13SAlexey Lapshin            - BlockData:
182f9f92f13SAlexey Lapshin                - 0x0e
183f9f92f13SAlexey Lapshin                - 0x00
184f9f92f13SAlexey Lapshin                - 0x00
185f9f92f13SAlexey Lapshin                - 0x01
186f9f92f13SAlexey Lapshin                - 0x00
187f9f92f13SAlexey Lapshin                - 0x00
188f9f92f13SAlexey Lapshin                - 0x00
189f9f92f13SAlexey Lapshin                - 0x00
190f9f92f13SAlexey Lapshin                - 0x00
191f9f92f13SAlexey Lapshin                - 0x9b
192f9f92f13SAlexey Lapshin        - AbbrCode: 0
193f9f92f13SAlexey Lapshin        - AbbrCode: 0
194f9f92f13SAlexey Lapshin...
195