blob: 96865befe385ff6679d3813ff3343226f765e1d6 [file] [log] [blame]
Rafael Espindolaf7c10a32010-09-21 00:24:38 +00001// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump --dump-section-data | FileCheck %s
2
3
4 .text
5
6// Test that this produces a regular local symbol.
7 .type common1,@object
8 .local common1
9 .comm common1,1,1
10
Jason W Kimf7d52782010-10-19 17:39:10 +000011// CHECK: ('st_name', 0x00000001) # 'common1'
12// CHECK-NEXT: ('st_bind', 0x00000000)
13// CHECK-NEXT: ('st_type', 0x00000001)
14// CHECK-NEXT: ('st_other', 0x00000000)
Rafael Espindolaf7c10a32010-09-21 00:24:38 +000015// CHECK-NEXT: ('st_shndx',
Jason W Kimf7d52782010-10-19 17:39:10 +000016// CHECK-NEXT: ('st_value', 0x00000000)
17// CHECK-NEXT: ('st_size', 0x00000001)
Rafael Espindolaf7c10a32010-09-21 00:24:38 +000018
19
20// Same as common1, but with directives in a different order.
21 .local common2
22 .type common2,@object
23 .comm common2,1,1
24
Jason W Kimf7d52782010-10-19 17:39:10 +000025// CHECK: ('st_name', 0x00000009) # 'common2'
26// CHECK-NEXT: ('st_bind', 0x00000000)
27// CHECK-NEXT: ('st_type', 0x00000001)
28// CHECK-NEXT: ('st_other', 0x00000000)
Rafael Espindolaf7c10a32010-09-21 00:24:38 +000029// CHECK-NEXT: ('st_shndx',
Jason W Kimf7d52782010-10-19 17:39:10 +000030// CHECK-NEXT: ('st_value', 0x00000001)
31// CHECK-NEXT: ('st_size', 0x00000001)
Rafael Espindolaf7c10a32010-09-21 00:24:38 +000032
33// Test that without an explicit .local we produce a global.
34 .type common3,@object
35 .comm common3,4,4
36
Jason W Kimf7d52782010-10-19 17:39:10 +000037// CHECK: ('st_name', 0x00000011) # 'common3'
38// CHECK-NEXT: ('st_bind', 0x00000001)
39// CHECK-NEXT: ('st_type', 0x00000001)
40// CHECK-NEXT: ('st_other', 0x00000000)
41// CHECK-NEXT: ('st_shndx', 0x0000fff2)
42// CHECK-NEXT: ('st_value', 0x00000004)
43// CHECK-NEXT: ('st_size', 0x00000004)
Rafael Espindolaf7c10a32010-09-21 00:24:38 +000044
45
46// Test that without an explicit .local we produce a global, even if the first
47// occurrence is not in a directive.
48 .globl foo
49 .type foo,@function
50foo:
51 movsbl common4+3(%rip), %eax
52
53
54 .type common4,@object
55 .comm common4,40,16
56
Jason W Kimf7d52782010-10-19 17:39:10 +000057// CHECK: ('st_name', 0x0000001d) # 'common4'
58// CHECK-NEXT: ('st_bind', 0x00000001)
59// CHECK-NEXT: ('st_type', 0x00000001)
60// CHECK-NEXT: ('st_other', 0x00000000)
61// CHECK-NEXT: ('st_shndx', 0x0000fff2)
62// CHECK-NEXT: ('st_value', 0x00000010)
63// CHECK-NEXT: ('st_size', 0x00000028)
Rafael Espindola765fb1a2010-11-14 19:40:55 +000064
65 .comm common5,4,4
66
67// CHECK: # Symbol 0x00000008
68// CHECK-NEXT: (('st_name', 0x00000025) # 'common5'
69// CHECK-NEXT: ('st_bind', 0x00000001)
70// CHECK-NEXT: ('st_type', 0x00000001)
71// CHECK-NEXT: ('st_other', 0x00000000)
72// CHECK-NEXT: ('st_shndx', 0x0000fff2)
73// CHECK-NEXT: ('st_value', 0x00000004)
74// CHECK-NEXT: ('st_size', 0x00000004)
75// CHECK-NEXT: ),