## Test writing stub elf with minimal sections. # RUN: llvm-elfabi %s --output-target=elf32-little %t.elf32l # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf32l | FileCheck %s -DCLASS="32-bit (0x1)" -DDE="LittleEndian (0x1)" -DHS=52 -DPHES=32 -DSHES=40 -DDYNSYMAL=4 -DDYNSYMES=16 -DDYNAMICAL=4 -DDYNAMICES=8 -DDYNTABZ=0 # RUN: llvm-elfabi %s --output-target=elf32-big %t.elf32b # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf32b | FileCheck %s -DCLASS="32-bit (0x1)" -DDE="BigEndian (0x2)" -DHS=52 -DPHES=32 -DSHES=40 -DDYNSYMAL=4 -DDYNSYMES=16 -DDYNAMICAL=4 -DDYNAMICES=8 -DDYNTABZ=0 # RUN: llvm-elfabi %s --output-target=elf64-little %t.elf64l # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf64l | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000 # RUN: llvm-elfabi %s --output-target=elf64-big %t.elf64b # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf64b | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="BigEndian (0x2)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000 --- !tapi-tbe TbeVersion: 1.0 Arch: x86_64 NeededLibs: - libc.so.6 Symbols: bar: { Type: Object, Size: 42 } baz: { Type: TLS, Size: 3 } plus: { Type: Func } ... # CHECK: ElfHeader { # CHECK-NEXT: Ident { # CHECK-NEXT: Magic: (7F 45 4C 46) # CHECK-NEXT: Class: [[CLASS]] # CHECK-NEXT: DataEncoding: [[DE]] # CHECK-NEXT: FileVersion: 1 # CHECK-NEXT: OS/ABI: SystemV (0x0) # CHECK-NEXT: ABIVersion: 0 # CHECK-NEXT: Unused: (00 00 00 00 00 00 00) # CHECK-NEXT: } # CHECK-NEXT: Type: SharedObject (0x3) # CHECK-NEXT: Machine: EM_X86_64 (0x3E) # CHECK-NEXT: Version: 1 # CHECK-NEXT: Entry: 0x0 # CHECK: Flags [ (0x0) # CHECK-NEXT: ] # CHECK-NEXT: HeaderSize: [[HS]] # CHECK-NEXT: ProgramHeaderEntrySize: [[PHES]] # CHECK: SectionHeaderEntrySize: [[SHES]] # CHECK: SectionHeaderCount: 5 # CHECK: StringTableSectionIndex: 4 # CHECK: Section { # CHECK-NEXT: Index: 0 # CHECK-NEXT: Name: (0) # CHECK-NEXT: Type: SHT_NULL # CHECK-NEXT: Flags [ # CHECK-NEXT: ] # CHECK-NEXT: Address: 0x0 # CHECK-NEXT: Offset: 0x0 # CHECK-NEXT: Size: 0 # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 # CHECK-NEXT: AddressAlignment: 0 # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 1 # CHECK-NEXT: Name: .dynsym # CHECK-NEXT: Type: SHT_DYNSYM # CHECK-NEXT: Flags [ # CHECK-NEXT: SHF_ALLOC # CHECK-NEXT: ] # CHECK-NEXT: Address: # CHECK-NEXT: Offset: # CHECK-NEXT: Size: # CHECK-NEXT: Link: 2 # CHECK-NEXT: Info: 1 # CHECK-NEXT: AddressAlignment: [[DYNSYMAL]] # CHECK-NEXT: EntrySize: [[DYNSYMES]] # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 2 # CHECK-NEXT: Name: .dynstr # CHECK-NEXT: Type: SHT_STRTAB # CHECK-NEXT: Flags [ # CHECK-NEXT: SHF_ALLOC # CHECK-NEXT: ] # CHECK-NEXT: Address: # CHECK-NEXT: Offset: # CHECK-NEXT: Size: # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 # CHECK-NEXT: AddressAlignment: 1 # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 3 # CHECK-NEXT: Name: .dynamic # CHECK-NEXT: Type: SHT_DYNAMIC # CHECK-NEXT: Flags [ # CHECK-NEXT: SHF_ALLOC # CHECK-NEXT: ] # CHECK-NEXT: Address: # CHECK-NEXT: Offset: # CHECK-NEXT: Size: # CHECK-NEXT: Link: 2 # CHECK-NEXT: Info: 0 # CHECK-NEXT: AddressAlignment: [[DYNAMICAL]] # CHECK-NEXT: EntrySize: [[DYNAMICES]] # CHECK-NEXT: } # CHECK-NEXT: Section { # CHECK-NEXT: Index: 4 # CHECK-NEXT: Name: .shstrtab # CHECK-NEXT: Type: SHT_STRTAB # CHECK-NEXT: Flags [ # CHECK-NEXT: ] # CHECK-NEXT: Address: # CHECK-NEXT: Offset: # CHECK-NEXT: Size: # CHECK-NEXT: Link: 0 # CHECK-NEXT: Info: 0 # CHECK-NEXT: AddressAlignment: 1 # CHECK-NEXT: EntrySize: 0 # CHECK-NEXT: } # CHECK: DynamicSection [ (4 entries) # CHECK-NEXT: Tag Type Name/Value # CHECK-NEXT: 0x[[DYNTABZ]]0000006 SYMTAB # CHECK-NEXT: 0x[[DYNTABZ]]0000005 STRTAB # CHECK-NEXT: 0x[[DYNTABZ]]0000001 NEEDED Shared library: [libc.so.6] # CHECK-NEXT: 0x[[DYNTABZ]]0000000 NULL # CHECK-NEXT: ] # CHECK: Symbol { # CHECK-NEXT: Name: # CHECK-NEXT: Value: # CHECK-NEXT: Size: # CHECK-NEXT: Binding: Local # CHECK-NEXT: Type: None # CHECK-NEXT: Other: 0 # CHECK-NEXT: Section: Undefined # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: bar # CHECK-NEXT: Value: # CHECK-NEXT: Size: 42 # CHECK-NEXT: Binding: Global # CHECK-NEXT: Type: Object # CHECK-NEXT: Other: 0 # CHECK-NEXT: Section: .dynsym # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: baz # CHECK-NEXT: Value: # CHECK-NEXT: Size: 3 # CHECK-NEXT: Binding: Global # CHECK-NEXT: Type: TLS # CHECK-NEXT: Other: 0 # CHECK-NEXT: Section: .dynsym # CHECK-NEXT: } # CHECK-NEXT: Symbol { # CHECK-NEXT: Name: plus # CHECK-NEXT: Value: # CHECK-NEXT: Size: # CHECK-NEXT: Binding: Global # CHECK-NEXT: Type: Function # CHECK-NEXT: Other: 0 # CHECK-NEXT: Section: .dynsym # CHECK-NEXT: } # CHECK: String dump of section '.dynstr': # CHECK-NEXT: [ 1] baz # CHECK-NEXT: [ 5] plus # CHECK-NEXT: [ a] bar # CHECK-NEXT: [ e] libc.so.6 # CHECK: String dump of section '.shstrtab': # CHECK-NEXT: [ 1] .dynstr # CHECK-NEXT: [ 9] .dynsym # CHECK-NEXT: [ 11] .dynamic # CHECK-NEXT: [ 1a] .shstrtab