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 don't create a .symtab_shndx since we are one section short of
6// SHN_LORESERVE (0xFF00).
7
8// SECTIONS-NOT: Name: .symtab_shndx
9
10// Check the last referenced section.
11
12// SYMBOLS:         Name: dm (0)
13// SYMBOLS-NEXT:    Value: 0x0
14// SYMBOLS-NEXT:    Size: 0
15// SYMBOLS-NEXT:    Binding: Local (0x0)
16// SYMBOLS-NEXT:    Type: Section (0x3)
17// SYMBOLS-NEXT:    Other: 0
18// SYMBOLS-NEXT:    Section: dm (0xFEFF)
19// SYMBOLS-NEXT:  }
20// SYMBOLS-NEXT:]
21
22.macro gen_sections4 x
23        .section a\x
24        .section b\x
25        .section c\x
26        .section d\x
27.endm
28
29.macro gen_sections8 x
30        gen_sections4 a\x
31        gen_sections4 b\x
32.endm
33
34.macro gen_sections16 x
35        gen_sections8 a\x
36        gen_sections8 b\x
37.endm
38
39.macro gen_sections32 x
40        gen_sections16 a\x
41        gen_sections16 b\x
42.endm
43
44.macro gen_sections64 x
45        gen_sections32 a\x
46        gen_sections32 b\x
47.endm
48
49.macro gen_sections128 x
50        gen_sections64 a\x
51        gen_sections64 b\x
52.endm
53
54.macro gen_sections256 x
55        gen_sections128 a\x
56        gen_sections128 b\x
57.endm
58
59.macro gen_sections512 x
60        gen_sections256 a\x
61        gen_sections256 b\x
62.endm
63
64.macro gen_sections1024 x
65        gen_sections512 a\x
66        gen_sections512 b\x
67.endm
68
69.macro gen_sections2048 x
70        gen_sections1024 a\x
71        gen_sections1024 b\x
72.endm
73
74.macro gen_sections4096 x
75        gen_sections2048 a\x
76        gen_sections2048 b\x
77.endm
78
79.macro gen_sections8192 x
80        gen_sections4096 a\x
81        gen_sections4096 b\x
82.endm
83
84.macro gen_sections16384 x
85        gen_sections8192 a\x
86        gen_sections8192 b\x
87.endm
88
89.macro gen_sections32768 x
90        gen_sections16384 a\x
91        gen_sections16384 b\x
92.endm
93
94gen_sections32768 a
95gen_sections16384 b
96gen_sections8192 c
97gen_sections4096 d
98gen_sections2048 e
99gen_sections1024 f
100gen_sections512 g
101gen_sections128 h
102gen_sections64 i
103gen_sections32 j
104gen_sections16 k
105gen_sections8 l
106gen_sections4 m
107