Fix the bitwidth of the remaining fields.
[oota-llvm.git] / test / MC / ELF / section.s
1 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump  | FileCheck %s
2
3 // Test that these names are accepted.
4
5 .section        .note.GNU-stack,"",@progbits
6 .section        .note.GNU-stack2,"",%progbits
7 .section        .note.GNU-,"",@progbits
8 .section        -.note.GNU,"",@progbits
9
10 // CHECK: ('sh_name', 0x00000038) # '.note.GNU-stack'
11 // CHECK: ('sh_name', 0x0000008f) # '.note.GNU-stack2'
12 // CHECK: ('sh_name', 0x000000a0) # '.note.GNU-'
13 // CHECK: ('sh_name', 0x00000084) # '-.note.GNU'
14
15 // Test that the defaults are used
16
17 .section        .init
18 .section        .fini
19 .section        .rodata
20 .section        zed, ""
21
22 // CHECK:      (('sh_name', 0x00000012) # '.init'
23 // CHECK-NEXT:  ('sh_type', 0x00000001)
24 // CHECK-NEXT:  ('sh_flags', 0x0000000000000006)
25 // CHECK-NEXT:  ('sh_addr', 0x0000000000000000)
26 // CHECK-NEXT:  ('sh_offset', 0x0000000000000050)
27 // CHECK-NEXT:  ('sh_size', 0x0000000000000000)
28 // CHECK-NEXT:  ('sh_link', 0x00000000)
29 // CHECK-NEXT:  ('sh_info', 0x00000000)
30 // CHECK-NEXT:  ('sh_addralign', 0x0000000000000001)
31 // CHECK-NEXT:  ('sh_entsize', 0x0000000000000000)
32 // CHECK-NEXT: ),
33 // CHECK-NEXT: # Section 11
34 // CHECK-NEXT: (('sh_name', 0x00000048) # '.fini'
35 // CHECK-NEXT:  ('sh_type', 0x00000001)
36 // CHECK-NEXT:  ('sh_flags', 0x0000000000000006)
37 // CHECK-NEXT:  ('sh_addr', 0x0000000000000000)
38 // CHECK-NEXT:  ('sh_offset', 0x0000000000000050)
39 // CHECK-NEXT:  ('sh_size', 0x0000000000000000)
40 // CHECK-NEXT:  ('sh_link', 0x00000000)
41 // CHECK-NEXT:  ('sh_info', 0x00000000)
42 // CHECK-NEXT:  ('sh_addralign', 0x0000000000000001)
43 // CHECK-NEXT:  ('sh_entsize', 0x0000000000000000)
44 // CHECK-NEXT: ),
45 // CHECK-NEXT: # Section 12
46 // CHECK-NEXT: (('sh_name', 0x00000076) # '.rodata'
47 // CHECK-NEXT:  ('sh_type', 0x00000001)
48 // CHECK-NEXT:  ('sh_flags', 0x0000000000000002)
49 // CHECK-NEXT:  ('sh_addr', 0x0000000000000000)
50 // CHECK-NEXT:  ('sh_offset', 0x0000000000000050)
51 // CHECK-NEXT:  ('sh_size', 0x0000000000000000)
52 // CHECK-NEXT:  ('sh_link', 0x00000000)
53 // CHECK-NEXT:  ('sh_info', 0x00000000)
54 // CHECK-NEXT:  ('sh_addralign', 0x0000000000000001)
55 // CHECK-NEXT:  ('sh_entsize', 0x0000000000000000)
56 // CHECK-NEXT: ),
57 // CHECK-NEXT: # Section 13
58 // CHECK-NEXT: (('sh_name', 0x00000058) # 'zed'
59 // CHECK-NEXT:  ('sh_type', 0x00000001)
60 // CHECK-NEXT:  ('sh_flags', 0x0000000000000000)
61 // CHECK-NEXT:  ('sh_addr', 0x0000000000000000)
62 // CHECK-NEXT:  ('sh_offset', 0x0000000000000050)
63 // CHECK-NEXT:  ('sh_size', 0x0000000000000000)
64 // CHECK-NEXT:  ('sh_link', 0x00000000)
65 // CHECK-NEXT:  ('sh_info', 0x00000000)
66 // CHECK-NEXT:  ('sh_addralign', 0x0000000000000001)
67 // CHECK-NEXT:  ('sh_entsize', 0x0000000000000000)
68 // CHECK-NEXT: ),
69
70 .section        .note.test,"",@note
71 // CHECK:       (('sh_name', 0x00000007) # '.note.test'
72 // CHECK-NEXT:   ('sh_type', 0x00000007)
73 // CHECK-NEXT:   ('sh_flags', 0x0000000000000000)
74 // CHECK-NEXT:   ('sh_addr', 0x0000000000000000)
75 // CHECK-NEXT:   ('sh_offset', 0x0000000000000050)
76 // CHECK-NEXT:   ('sh_size', 0x0000000000000000)
77 // CHECK-NEXT:   ('sh_link', 0x00000000)
78 // CHECK-NEXT:   ('sh_info', 0x00000000)
79 // CHECK-NEXT:   ('sh_addralign', 0x0000000000000001)
80 // CHECK-NEXT:   ('sh_entsize', 0x0000000000000000)
81 // CHECK-NEXT:  ),
82
83 // Test that we can parse these
84 foo:
85 bar:
86 .section        .text.foo,"axG",@progbits,foo,comdat
87 .section        .text.bar,"axMG",@progbits,42,bar,comdat
88
89 // Test that the default values are not used
90
91 .section .eh_frame,"a",@unwind
92
93 // CHECK:       (('sh_name', 0x0000004e) # '.eh_frame'
94 // CHECK-NEXT:   ('sh_type', 0x70000001)
95 // CHECK-NEXT:   ('sh_flags', 0x0000000000000002)
96 // CHECK-NEXT:   ('sh_addr', 0x0000000000000000)
97 // CHECK-NEXT:   ('sh_offset', 0x0000000000000050)
98 // CHECK-NEXT:   ('sh_size', 0x0000000000000000)
99 // CHECK-NEXT:   ('sh_link', 0x00000000)
100 // CHECK-NEXT:   ('sh_info', 0x00000000)
101 // CHECK-NEXT:   ('sh_addralign', 0x0000000000000001)
102 // CHECK-NEXT:   ('sh_entsize', 0x0000000000000000)
103 // CHECK-NEXT:  ),
104
105 // Test that we handle the strings like gas
106 .section bar-"foo"
107 .section "foo"
108
109 // CHECK: ('sh_name', 0x000000ab) # 'bar-"foo"'
110 // CHECK: ('sh_name', 0x00000034) # 'foo'