xref: /llvm-project/llvm/test/MC/COFF/bigobj.py (revision b71edfaa4ec3c998aadb35255ce2f60bba2940b0)
1# RUN: %python %s | llvm-mc -filetype=obj -triple i686-pc-win32 - | llvm-readobj -h - | FileCheck %s
2
3from __future__ import print_function
4
5# This test checks that the COFF object emitter can produce objects with
6# more than 65279 sections.
7
8# While we only generate 65277 sections, an implicit .text, .data and .bss will
9# also be emitted.  This brings the total to 65280.
10num_sections = 65277
11
12# CHECK:      ImageFileHeader {
13# CHECK-NEXT:   Machine: IMAGE_FILE_MACHINE_I386
14# CHECK-NEXT:   SectionCount: 65280
15# CHECK-NEXT:   TimeDateStamp: {{[0-9]+}}
16# CHECK-NEXT:   PointerToSymbolTable: 0x{{[0-9A-F]+}}
17# CHECK-NEXT:   SymbolCount: 195837
18# CHECK-NEXT:   StringTableSize: {{[0-9]+}}
19# CHECK-NEXT:   OptionalHeaderSize: 0
20# CHECK-NEXT:   Characteristics [ (0x0)
21# CHECK-NEXT:   ]
22# CHECK-NEXT: }
23
24for i in range(0, num_sections):
25    print(
26        """	.section	.bss,"bw",discard,_b%d
27	.globl	_b%d                     # @b%d
28_b%d:
29	.byte	0                       # 0x0
30"""
31        % (i, i, i, i)
32    )
33