1## Test writing stub elf with minimal sections. 2 3# RUN: llvm-elfabi %s --output-target=elf32-little %t.elf32l 4# 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 5 6# RUN: llvm-elfabi %s --output-target=elf32-big %t.elf32b 7# 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 8 9# RUN: llvm-elfabi %s --output-target=elf64-little %t.elf64l 10# 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 11 12# RUN: llvm-elfabi %s --output-target=elf64-big %t.elf64b 13# 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 14 15--- !tapi-tbe 16TbeVersion: 1.0 17Arch: x86_64 18NeededLibs: 19 - libc.so.6 20Symbols: 21 bar: { Type: Object, Size: 42 } 22 baz: { Type: TLS, Size: 3 } 23 plus: { Type: Func } 24... 25 26# CHECK: ElfHeader { 27# CHECK-NEXT: Ident { 28# CHECK-NEXT: Magic: (7F 45 4C 46) 29# CHECK-NEXT: Class: [[CLASS]] 30# CHECK-NEXT: DataEncoding: [[DE]] 31# CHECK-NEXT: FileVersion: 1 32# CHECK-NEXT: OS/ABI: SystemV (0x0) 33# CHECK-NEXT: ABIVersion: 0 34# CHECK-NEXT: Unused: (00 00 00 00 00 00 00) 35# CHECK-NEXT: } 36# CHECK-NEXT: Type: SharedObject (0x3) 37# CHECK-NEXT: Machine: EM_X86_64 (0x3E) 38# CHECK-NEXT: Version: 1 39# CHECK-NEXT: Entry: 0x0 40# CHECK: Flags [ (0x0) 41# CHECK-NEXT: ] 42# CHECK-NEXT: HeaderSize: [[HS]] 43# CHECK-NEXT: ProgramHeaderEntrySize: [[PHES]] 44# CHECK: SectionHeaderEntrySize: [[SHES]] 45# CHECK: SectionHeaderCount: 5 46# CHECK: StringTableSectionIndex: 4 47 48# CHECK: Section { 49# CHECK-NEXT: Index: 0 50# CHECK-NEXT: Name: (0) 51# CHECK-NEXT: Type: SHT_NULL 52# CHECK-NEXT: Flags [ 53# CHECK-NEXT: ] 54# CHECK-NEXT: Address: 0x0 55# CHECK-NEXT: Offset: 0x0 56# CHECK-NEXT: Size: 0 57# CHECK-NEXT: Link: 0 58# CHECK-NEXT: Info: 0 59# CHECK-NEXT: AddressAlignment: 0 60# CHECK-NEXT: EntrySize: 0 61# CHECK-NEXT: } 62# CHECK-NEXT: Section { 63# CHECK-NEXT: Index: 1 64# CHECK-NEXT: Name: .dynsym 65# CHECK-NEXT: Type: SHT_DYNSYM 66# CHECK-NEXT: Flags [ 67# CHECK-NEXT: SHF_ALLOC 68# CHECK-NEXT: ] 69# CHECK-NEXT: Address: 70# CHECK-NEXT: Offset: 71# CHECK-NEXT: Size: 72# CHECK-NEXT: Link: 2 73# CHECK-NEXT: Info: 1 74# CHECK-NEXT: AddressAlignment: [[DYNSYMAL]] 75# CHECK-NEXT: EntrySize: [[DYNSYMES]] 76# CHECK-NEXT: } 77# CHECK-NEXT: Section { 78# CHECK-NEXT: Index: 2 79# CHECK-NEXT: Name: .dynstr 80# CHECK-NEXT: Type: SHT_STRTAB 81# CHECK-NEXT: Flags [ 82# CHECK-NEXT: SHF_ALLOC 83# CHECK-NEXT: ] 84# CHECK-NEXT: Address: 85# CHECK-NEXT: Offset: 86# CHECK-NEXT: Size: 87# CHECK-NEXT: Link: 0 88# CHECK-NEXT: Info: 0 89# CHECK-NEXT: AddressAlignment: 1 90# CHECK-NEXT: EntrySize: 0 91# CHECK-NEXT: } 92# CHECK-NEXT: Section { 93# CHECK-NEXT: Index: 3 94# CHECK-NEXT: Name: .dynamic 95# CHECK-NEXT: Type: SHT_DYNAMIC 96# CHECK-NEXT: Flags [ 97# CHECK-NEXT: SHF_ALLOC 98# CHECK-NEXT: ] 99# CHECK-NEXT: Address: 100# CHECK-NEXT: Offset: 101# CHECK-NEXT: Size: 102# CHECK-NEXT: Link: 2 103# CHECK-NEXT: Info: 0 104# CHECK-NEXT: AddressAlignment: [[DYNAMICAL]] 105# CHECK-NEXT: EntrySize: [[DYNAMICES]] 106# CHECK-NEXT: } 107# CHECK-NEXT: Section { 108# CHECK-NEXT: Index: 4 109# CHECK-NEXT: Name: .shstrtab 110# CHECK-NEXT: Type: SHT_STRTAB 111# CHECK-NEXT: Flags [ 112# CHECK-NEXT: ] 113# CHECK-NEXT: Address: 114# CHECK-NEXT: Offset: 115# CHECK-NEXT: Size: 116# CHECK-NEXT: Link: 0 117# CHECK-NEXT: Info: 0 118# CHECK-NEXT: AddressAlignment: 1 119# CHECK-NEXT: EntrySize: 0 120# CHECK-NEXT: } 121 122# CHECK: DynamicSection [ (4 entries) 123# CHECK-NEXT: Tag Type Name/Value 124# CHECK-NEXT: 0x[[DYNTABZ]]0000006 SYMTAB 125# CHECK-NEXT: 0x[[DYNTABZ]]0000005 STRTAB 126# CHECK-NEXT: 0x[[DYNTABZ]]0000001 NEEDED Shared library: [libc.so.6] 127# CHECK-NEXT: 0x[[DYNTABZ]]0000000 NULL 128# CHECK-NEXT: ] 129 130# CHECK: Symbol { 131# CHECK-NEXT: Name: 132# CHECK-NEXT: Value: 133# CHECK-NEXT: Size: 134# CHECK-NEXT: Binding: Local 135# CHECK-NEXT: Type: None 136# CHECK-NEXT: Other: 0 137# CHECK-NEXT: Section: Undefined 138# CHECK-NEXT: } 139# CHECK-NEXT: Symbol { 140# CHECK-NEXT: Name: bar 141# CHECK-NEXT: Value: 142# CHECK-NEXT: Size: 42 143# CHECK-NEXT: Binding: Global 144# CHECK-NEXT: Type: Object 145# CHECK-NEXT: Other: 0 146# CHECK-NEXT: Section: .dynsym 147# CHECK-NEXT: } 148# CHECK-NEXT: Symbol { 149# CHECK-NEXT: Name: baz 150# CHECK-NEXT: Value: 151# CHECK-NEXT: Size: 3 152# CHECK-NEXT: Binding: Global 153# CHECK-NEXT: Type: TLS 154# CHECK-NEXT: Other: 0 155# CHECK-NEXT: Section: .dynsym 156# CHECK-NEXT: } 157# CHECK-NEXT: Symbol { 158# CHECK-NEXT: Name: plus 159# CHECK-NEXT: Value: 160# CHECK-NEXT: Size: 161# CHECK-NEXT: Binding: Global 162# CHECK-NEXT: Type: Function 163# CHECK-NEXT: Other: 0 164# CHECK-NEXT: Section: .dynsym 165# CHECK-NEXT: } 166 167# CHECK: String dump of section '.dynstr': 168# CHECK-NEXT: [ 1] baz 169# CHECK-NEXT: [ 5] plus 170# CHECK-NEXT: [ a] bar 171# CHECK-NEXT: [ e] libc.so.6 172 173# CHECK: String dump of section '.shstrtab': 174# CHECK-NEXT: [ 1] .dynstr 175# CHECK-NEXT: [ 9] .dynsym 176# CHECK-NEXT: [ 11] .dynamic 177# CHECK-NEXT: [ 1a] .shstrtab 178