1 ## Show that llvm-objcopy can handle an input file with many sections.
3 RUN: %python %p/../Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
4 RUN: llvm-objcopy %t %t2
5 RUN: llvm-readobj --file-headers --sections --symbols %t2 | FileCheck %s
6 RUN: llvm-readelf --symbols %t2 | FileCheck --check-prefix=SYMS %s
8 ## The ELF header should have e_shnum == 0 and e_shstrndx == SHN_XINDEX.
9 # CHECK: SectionHeaderCount: 0
10 # CHECK-NEXT: StringTableSectionIndex: 65535
12 ## The first section header should store the real section header count and
13 ## shstrndx in its fields.
15 # CHECK-NEXT: Index: 0
17 # CHECK-NEXT: Type: SHT_NULL
20 # CHECK-NEXT: Address:
22 # CHECK-NEXT: Size: [[#SHNUM:]]
23 # CHECK-NEXT: Link: [[#SHNUM-1]]
25 ## Show that the .symtab_shndx section has the correct properties.
26 ## To avoid accidentally capturing the index of an unrelated section header for
27 ## checking the sh_link of the .symtab_shndx section, use the index of the
28 ## section immediately following the symbol table.
29 # CHECK: Name: .symtab
30 # CHECK-NEXT: Type: SHT_SYMTAB
31 # CHECK: Index: [[#AFTERSYMTAB:]]
32 # CHECK: Name: .symtab_shndx
33 # CHECK-NEXT: Type: SHT_SYMTAB_SHNDX
34 # CHECK-NEXT: Flags [ (0x0)
36 # CHECK-NEXT: Address: 0x0
38 ## There should be #syms * EntrySize bytes.
39 # CHECK-NEXT: Size: 262148
40 # CHECK-NEXT: Link: [[#AFTERSYMTAB-1]]
42 # CHECK-NEXT: AddressAlignment: 4
43 # CHECK-NEXT: EntrySize: 4
44 ## Show that the sh_link of the first section header is the section header table
45 ## index. Also show that the last section is the .strtab.
46 # CHECK: Index: [[#SHNUM-1]]
47 # CHECK-NEXT: Name: .strtab
49 ## Show that the symbols with section indexes around the reserved range still
50 ## have the right section indexes afterwards.
51 # CHECK: Section: s65279 (0xFEFF)
53 ## st_shndx == SHN_LORSERVE.
54 # CHECK-NEXT: Symbol {
55 # CHECK-NEXT: Name: sym65280 (
56 # CHECK-NEXT: Value: 0x0
58 # CHECK-NEXT: Binding: Local (0x0)
59 # CHECK-NEXT: Type: None (0x0)
60 # CHECK-NEXT: Other: 0
61 # CHECK-NEXT: Section: s65280 (0xFF00)
63 ## st_shndx == SHN_ABS.
64 # CHECK: Name: sym65521 (
65 # CHECK-NEXT: Value: 0x0
67 # CHECK-NEXT: Binding: Local (0x0)
68 # CHECK-NEXT: Type: None (0x0)
69 # CHECK-NEXT: Other: 0
70 # CHECK-NEXT: Section: s65521 (0xFFF1)
72 ## st_shndx == SHN_COMMON.
73 # CHECK-NEXT: Symbol {
74 # CHECK-NEXT: Name: sym65522 (
75 # CHECK-NEXT: Value: 0x0
77 # CHECK-NEXT: Binding: Local (0x0)
78 # CHECK-NEXT: Type: None (0x0)
79 # CHECK-NEXT: Other: 0
80 # CHECK-NEXT: Section: s65522 (0xFFF2)
82 ## st_shndx == SHN_XINDEX.
83 # CHECK: Name: sym65535 (
84 # CHECK-NEXT: Value: 0x0
86 # CHECK-NEXT: Binding: Local (0x0)
87 # CHECK-NEXT: Type: None (0x0)
88 # CHECK-NEXT: Other: 0
89 # CHECK-NEXT: Section: s65535 (0xFFFF)
91 ## st_shndx > SHN_XINDEX.
92 # CHECK-NEXT: Symbol {
93 # CHECK-NEXT: Name: sym65536 (
94 # CHECK-NEXT: Value: 0x0
96 # CHECK-NEXT: Binding: Local (0x0)
97 # CHECK-NEXT: Type: None (0x0)
98 # CHECK-NEXT: Other: 0
99 # CHECK-NEXT: Section: s65536 (0x10000)
102 # SYMS: Symbol table '.symtab' contains 65537 entries