1 ## Test that we are able to dump section headers even if the
2 ## .dynsym section's sh_link field is broken.
4 ## Case 1: sh_link is set to 0.
5 # RUN: yaml2obj --docnum=1 %s -o %t1
6 # RUN: llvm-readobj -S %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefixes=LLVM,ERR
7 # RUN: llvm-readelf -S %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefixes=GNU,ERR
9 # ERR: warning: '[[FILE]]': invalid sh_type for string table section [index 0]: expected SHT_STRTAB, but got SHT_NULL
12 # LLVM-NEXT: Type: SHT_DYNSYM
14 # LLVM-NEXT: SHF_ALLOC
16 # LLVM-NEXT: Address: 0x0
17 # LLVM-NEXT: Offset: 0x40
21 # GNU: Section Headers:
22 # GNU-NEXT: [Nr] Name Type Address Off Size ES Flg Lk
23 # GNU-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0
24 # GNU-NEXT: [ 1] .dynsym DYNSYM 0000000000000000 000040 000018 18 A 0
36 ## Case 2: sh_link is set to 255, which is larger than the number of the sections.
37 # RUN: yaml2obj --docnum=2 %s -o %t2
39 # RUN: llvm-readobj -S %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefixes=LLVM2,ERR2
40 # RUN: llvm-readelf -S %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefixes=GNU2,ERR2
42 # ERR2: warning: '[[FILE]]': invalid section index
55 # LLVM2: Name: .dynsym
56 # LLVM2-NEXT: Type: SHT_DYNSYM
58 # LLVM2-NEXT: SHF_ALLOC
60 # LLVM2-NEXT: Address: 0x0
61 # LLVM2-NEXT: Offset: 0x40
62 # LLVM2-NEXT: Size: 24
63 # LLVM2-NEXT: Link: 255
65 # GNU2: Section Headers:
66 # GNU2-NEXT: [Nr] Name Type Address Off Size ES Flg Lk
67 # GNU2-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0
68 # GNU2-NEXT: [ 1] .dynsym DYNSYM 0000000000000000 000040 000018 18 A 255