aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/tools/llvm-readobj/ELF/sections-no-section-header-string-table.test
blob: 7f0851ccc7d4c040bd1ccd76599aa9ad15c0b8fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
## Check what --sections prints when there is no section header string table.

# RUN: yaml2obj %s -o %t
# RUN: llvm-readelf --sections %t \
# RUN:   | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=GNU
# RUN: llvm-readobj --sections %t 2>&1 \
# RUN:   | FileCheck %s -DFILE=%t --check-prefix=LLVM

#      GNU:Section Headers:
# GNU-NEXT:  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
# GNU-NEXT:  [ 0] <no-strings>      NULL            0000000000000000 000000 000000 00      0   0  0
# GNU-NEXT:  [ 1] <no-strings>      PROGBITS        0000000000000000 000040 000000 00      0   0  0
# GNU-NEXT:  [ 2] <no-strings>      PROGBITS        0000000000000000 000040 000000 00      0   0  0
# GNU-NEXT:  [ 3] <no-strings>      STRTAB          0000000000000000 000040 000001 00      0   0  1
# GNU-NEXT:  [ 4] <no-strings>      STRTAB          0000000000000000 000041 00001d 00      0   0  1

# LLVM:      Sections [
# LLVM-NEXT:   Section {
# LLVM-NEXT:     Index: 0
# LLVM-NEXT:     Name:  (0)
# LLVM-NEXT:     Type: SHT_NULL (0x0)
# LLVM-NEXT:     Flags [ (0x0)
# LLVM-NEXT:     ]
# LLVM-NEXT:     Address: 0x0
# LLVM-NEXT:     Offset: 0x0
# LLVM-NEXT:     Size: 0
# LLVM-NEXT:     Link: 0
# LLVM-NEXT:     Info: 0
# LLVM-NEXT:     AddressAlignment: 0
# LLVM-NEXT:     EntrySize: 0
# LLVM-NEXT:   }
# LLVM-NEXT:   Section {
# LLVM-NEXT:     Index: 1
# LLVM-NEXT:     Name:  (0)
# LLVM-NEXT:     Type: SHT_PROGBITS (0x1)
# LLVM-NEXT:     Flags [ (0x0)
# LLVM-NEXT:     ]
# LLVM-NEXT:     Address: 0x0
# LLVM-NEXT:     Offset: 0x40
# LLVM-NEXT:     Size: 0
# LLVM-NEXT:     Link: 0
# LLVM-NEXT:     Info: 0
# LLVM-NEXT:     AddressAlignment: 0
# LLVM-NEXT:     EntrySize: 0
# LLVM-NEXT:   }
# LLVM-NEXT:  Section {
# LLVM-NEXT:    Index: 2
# LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_PROGBITS section with index 2: a section [index 2] has an invalid sh_name (0x1) offset which goes past the end of the section name string table
# LLVM-NEXT:    Name: <?> (1)
# LLVM-NEXT:    Type: SHT_PROGBITS (0x1)
# LLVM-NEXT:    Flags [ (0x0)
# LLVM-NEXT:    ]
# LLVM-NEXT:    Address: 0x0
# LLVM-NEXT:    Offset: 0x40
# LLVM-NEXT:    Size: 0
# LLVM-NEXT:    Link: 0
# LLVM-NEXT:    Info: 0
# LLVM-NEXT:    AddressAlignment: 0
# LLVM-NEXT:    EntrySize: 0
# LLVM-NEXT:  }
# LLVM-NEXT:   Section {
# LLVM-NEXT:     Index: 3
# LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_STRTAB section with index 3: a section [index 3] has an invalid sh_name (0x15) offset which goes past the end of the section name string table
# LLVM-NEXT:     Name: <?> (21)
# LLVM-NEXT:     Type: SHT_STRTAB (0x3)
# LLVM-NEXT:     Flags [ (0x0)
# LLVM-NEXT:     ]
# LLVM-NEXT:     Address: 0x0
# LLVM-NEXT:     Offset: 0x40
# LLVM-NEXT:     Size: 1
# LLVM-NEXT:     Link: 0
# LLVM-NEXT:     Info: 0
# LLVM-NEXT:     AddressAlignment: 1
# LLVM-NEXT:     EntrySize: 0
# LLVM-NEXT:   }
# LLVM-NEXT:   Section {
# LLVM-NEXT:     Index: 4
# LLVM-NEXT: warning: '[[FILE]]': unable to get the name of SHT_STRTAB section with index 4: a section [index 4] has an invalid sh_name (0xb) offset which goes past the end of the section name string table
# LLVM-NEXT:     Name: <?> (11)
# LLVM-NEXT:     Type: SHT_STRTAB (0x3)
# LLVM-NEXT:     Flags [ (0x0)
# LLVM-NEXT:     ]
# LLVM-NEXT:     Address: 0x0
# LLVM-NEXT:     Offset: 0x41
# LLVM-NEXT:     Size: 29
# LLVM-NEXT:     Link: 0
# LLVM-NEXT:     Info: 0
# LLVM-NEXT:     AddressAlignment: 1
# LLVM-NEXT:     EntrySize: 0
# LLVM-NEXT:   }
# LLVM-NEXT: ]

--- !ELF
FileHeader:
  Class:     ELFCLASS64
  Data:      ELFDATA2LSB
  Type:      ET_DYN
  EShStrNdx: 0
Sections:
  - Name:   .foo
    Type:   SHT_PROGBITS
    ShName: 0
  - Name:   .bar
    Type:   SHT_PROGBITS
    ShName: 1