• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t
2// RUN: llvm-readobj -s %t | FileCheck --check-prefix=SECTIONS %s
3// RUN: llvm-readobj -t %t | FileCheck --check-prefix=SYMBOLS %s
4
5// Test that we create a .symtab_shndx if a symbol points to a section
6// numbered SHN_LORESERVE (0xFF00) or higher.
7
8// SECTIONS: Name: .symtab_shndx
9
10// Test that we don't create a symbol for the symtab_shndx section.
11// SYMBOLS-NOT: symtab_shndx
12
13
14// Test that both a and b show up in the correct section.
15// SYMBOLS:         Name: a
16// SYMBOLS-NEXT:    Value: 0x0
17// SYMBOLS-NEXT:    Size: 0
18// SYMBOLS-NEXT:    Binding: Local (0x0)
19// SYMBOLS-NEXT:    Type: None (0x0)
20// SYMBOLS-NEXT:    Other: 0
21// SYMBOLS-NEXT:    Section: dm (0xFF00)
22// SYMBOLS-NEXT:  }
23// SYMBOLS-NEXT:  Symbol {
24// SYMBOLS-NEXT:    Name: b
25// SYMBOLS-NEXT:    Value: 0x1
26// SYMBOLS-NEXT:    Size: 0
27// SYMBOLS-NEXT:    Binding: Local (0x0)
28// SYMBOLS-NEXT:    Type: None (0x0)
29// SYMBOLS-NEXT:    Other: 0
30// SYMBOLS-NEXT:    Section: dm (0xFF00)
31// SYMBOLS-NEXT:  }
32
33
34// Test that this file has one section too many.
35// SYMBOLS:         Name: (0)
36// SYMBOLS:         Value: 0x0
37// SYMBOLS:         Size: 0
38// SYMBOLS:         Binding: Local (0x0)
39// SYMBOLS:         Type: Section (0x3)
40// SYMBOLS:         Other: 0
41// SYMBOLS:         Section: dm (0xFF00)
42// SYMBOLS-NEXT:  }
43// SYMBOLS-NEXT:]
44
45.macro gen_sections4 x
46        .section a\x
47        .section b\x
48        .section c\x
49        .section d\x
50.endm
51
52.macro gen_sections8 x
53        gen_sections4 a\x
54        gen_sections4 b\x
55.endm
56
57.macro gen_sections16 x
58        gen_sections8 a\x
59        gen_sections8 b\x
60.endm
61
62.macro gen_sections32 x
63        gen_sections16 a\x
64        gen_sections16 b\x
65.endm
66
67.macro gen_sections64 x
68        gen_sections32 a\x
69        gen_sections32 b\x
70.endm
71
72.macro gen_sections128 x
73        gen_sections64 a\x
74        gen_sections64 b\x
75.endm
76
77.macro gen_sections256 x
78        gen_sections128 a\x
79        gen_sections128 b\x
80.endm
81
82.macro gen_sections512 x
83        gen_sections256 a\x
84        gen_sections256 b\x
85.endm
86
87.macro gen_sections1024 x
88        gen_sections512 a\x
89        gen_sections512 b\x
90.endm
91
92.macro gen_sections2048 x
93        gen_sections1024 a\x
94        gen_sections1024 b\x
95.endm
96
97.macro gen_sections4096 x
98        gen_sections2048 a\x
99        gen_sections2048 b\x
100.endm
101
102.macro gen_sections8192 x
103        gen_sections4096 a\x
104        gen_sections4096 b\x
105.endm
106
107.macro gen_sections16384 x
108        gen_sections8192 a\x
109        gen_sections8192 b\x
110.endm
111
112.macro gen_sections32768 x
113        gen_sections16384 a\x
114        gen_sections16384 b\x
115.endm
116
117        .section foo
118        .section bar
119
120gen_sections32768 a
121gen_sections16384 b
122gen_sections8192 c
123gen_sections4096 d
124gen_sections2048 e
125gen_sections1024 f
126gen_sections512 g
127gen_sections128 h
128gen_sections64 i
129gen_sections32 j
130gen_sections16 k
131gen_sections8 l
132gen_sections4 m
133
134a:
135b = a + 1
136.long dm
137