2 # RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t.o
3 # RUN: ld.lld -r %t.o -o %t
5 ## Check we are able to link against relocatable file produced.
6 # RUN: ld.lld %t -o %t.out
8 ## Check we emit a valid ELF header when
9 ## sections amount is greater than SHN_LORESERVE.
10 # RUN: llvm-readobj --file-headers %t | FileCheck %s --check-prefix=HDR
12 # HDR: SectionHeaderCount: 0 (65544)
13 # HDR-NEXT: StringTableSectionIndex: 65535 (65542)
16 ## 1) 65541 is the index of .shstrtab section.
17 ## 2) .symtab_shndx is linked with .symtab.
18 ## 3) .symtab_shndx entry size and alignment == 4.
19 ## 4) .symtab_shndx has size equal to
20 ## (sizeof(.symtab) / entsize(.symtab)) * entsize(.symtab_shndx) = 0x4 * 0x180078 / 0x18 == 0x040014
22 # RUN: llvm-readelf -S -s %t | FileCheck %s
23 # [Nr] Name Type Address Off Size ES Flg Lk Inf Al
24 # CHECK: [65539] .note.GNU-stack PROGBITS 0000000000000000 000040 000000 00 0 0 1
25 # CHECK: [65540] .symtab SYMTAB 0000000000000000 000040 180078 18 65543 65539 8
26 # CHECK: [65541] .symtab_shndx SYMTAB SECTION INDICES 0000000000000000 1800b8 040014 04 65540 0 4
27 # CHECK: [65542] .shstrtab STRTAB 0000000000000000 1c00cc 0f0044 00 0 0 1
28 # CHECK: [65543] .strtab STRTAB 0000000000000000 2b0110 00000c 00 0 0 1
30 # 5) Check we are able to represent symbol foo with section (.bar) index > 0xFF00 (SHN_LORESERVE).
31 # CHECK: GLOBAL DEFAULT 65538 foo
33 .macro gen_sections4 x
40 .macro gen_sections8 x
45 .macro gen_sections16 x
50 .macro gen_sections32 x
55 .macro gen_sections64 x
60 .macro gen_sections128 x
65 .macro gen_sections256 x
70 .macro gen_sections512 x
75 .macro gen_sections1024 x
80 .macro gen_sections2048 x
85 .macro gen_sections4096 x
90 .macro gen_sections8192 x
95 .macro gen_sections16384 x