103 lines · plain
1## Show that llvm-objcopy can handle an input file with many sections.2 3RUN: %python %p/../Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t4RUN: llvm-objcopy %t %t25RUN: llvm-readobj --file-headers --sections --symbols %t2 | FileCheck %s6RUN: llvm-readelf --symbols %t2 | FileCheck --check-prefix=SYMS %s7 8## The ELF header should have e_shnum == 0 and e_shstrndx == SHN_XINDEX.9# CHECK: SectionHeaderCount: 010# CHECK-NEXT: StringTableSectionIndex: 6553511 12## The first section header should store the real section header count and13## shstrndx in its fields.14# CHECK: Section {15# CHECK-NEXT: Index: 016# CHECK-NEXT: Name:17# CHECK-NEXT: Type: SHT_NULL18# CHECK-NEXT: Flags [19# CHECK-NEXT: ]20# CHECK-NEXT: Address:21# CHECK-NEXT: Offset:22# CHECK-NEXT: Size: [[#SHNUM:]]23# CHECK-NEXT: Link: [[#SHNUM-1]]24 25## Show that the .symtab_shndx section has the correct properties.26## To avoid accidentally capturing the index of an unrelated section header for27## checking the sh_link of the .symtab_shndx section, use the index of the28## section immediately following the symbol table.29# CHECK: Name: .symtab30# CHECK-NEXT: Type: SHT_SYMTAB31# CHECK: Index: [[#AFTERSYMTAB:]]32# CHECK: Name: .symtab_shndx33# CHECK-NEXT: Type: SHT_SYMTAB_SHNDX34# CHECK-NEXT: Flags [ (0x0)35# CHECK-NEXT: ]36# CHECK-NEXT: Address: 0x037# CHECK-NEXT: Offset:38## There should be #syms * EntrySize bytes.39# CHECK-NEXT: Size: 26214840# CHECK-NEXT: Link: [[#AFTERSYMTAB-1]]41# CHECK-NEXT: Info: 042# CHECK-NEXT: AddressAlignment: 443# CHECK-NEXT: EntrySize: 444## Show that the sh_link of the first section header is the section header table45## index. Also show that the last section is the .strtab.46# CHECK: Index: [[#SHNUM-1]]47# CHECK-NEXT: Name: .strtab48 49## Show that the symbols with section indexes around the reserved range still50## have the right section indexes afterwards.51# CHECK: Section: s65279 (0xFEFF)52# CHECK-NEXT: }53## st_shndx == SHN_LORSERVE.54# CHECK-NEXT: Symbol {55# CHECK-NEXT: Name: sym65280 (56# CHECK-NEXT: Value: 0x057# CHECK-NEXT: Size: 058# CHECK-NEXT: Binding: Local (0x0)59# CHECK-NEXT: Type: None (0x0)60# CHECK-NEXT: Other: 061# CHECK-NEXT: Section: s65280 (0xFF00)62# CHECK-NEXT: }63## st_shndx == SHN_ABS.64# CHECK: Name: sym65521 (65# CHECK-NEXT: Value: 0x066# CHECK-NEXT: Size: 067# CHECK-NEXT: Binding: Local (0x0)68# CHECK-NEXT: Type: None (0x0)69# CHECK-NEXT: Other: 070# CHECK-NEXT: Section: s65521 (0xFFF1)71# CHECK-NEXT: }72## st_shndx == SHN_COMMON.73# CHECK-NEXT: Symbol {74# CHECK-NEXT: Name: sym65522 (75# CHECK-NEXT: Value: 0x076# CHECK-NEXT: Size: 077# CHECK-NEXT: Binding: Local (0x0)78# CHECK-NEXT: Type: None (0x0)79# CHECK-NEXT: Other: 080# CHECK-NEXT: Section: s65522 (0xFFF2)81# CHECK-NEXT: }82## st_shndx == SHN_XINDEX.83# CHECK: Name: sym65535 (84# CHECK-NEXT: Value: 0x085# CHECK-NEXT: Size: 086# CHECK-NEXT: Binding: Local (0x0)87# CHECK-NEXT: Type: None (0x0)88# CHECK-NEXT: Other: 089# CHECK-NEXT: Section: s65535 (0xFFFF)90# CHECK-NEXT: }91## st_shndx > SHN_XINDEX.92# CHECK-NEXT: Symbol {93# CHECK-NEXT: Name: sym65536 (94# CHECK-NEXT: Value: 0x095# CHECK-NEXT: Size: 096# CHECK-NEXT: Binding: Local (0x0)97# CHECK-NEXT: Type: None (0x0)98# CHECK-NEXT: Other: 099# CHECK-NEXT: Section: s65536 (0x10000)100# CHECK-NEXT: }101 102# SYMS: Symbol table '.symtab' contains 65537 entries103