dynamic-malformed.test 17.8 KB
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
## Test handling of a dynamic section size which is not a multiple of its entry size.
## Test the full output to demonstrate how we print the warnings.

# RUN: yaml2obj %s --docnum=1 -o %t.bad-size
# RUN: llvm-readobj --all %t.bad-size 2>&1 \
# RUN:   | FileCheck %s -DFILE=%t.bad-size --implicit-check-not=warning: --check-prefix WARN
# RUN: llvm-readelf --all %t.bad-size 2>&1 \
# RUN:   | FileCheck %s -DFILE=%t.bad-size --implicit-check-not=warning: --check-prefix WARN-GNU

# WARN: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x4){{$}}
# WARN: warning: '[[FILE]]': SHT_DYNAMIC section with index 1 has invalid size (0x4){{$}}
# WARN: warning: '[[FILE]]': no valid dynamic table was found
# WARN-EMPTY:
# WARN: File:
# WARN: ProgramHeaders [
# WARN: Symbols [
# WARN: ]

# WARN-GNU: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x4){{$}}
# WARN-GNU: warning: '[[FILE]]': SHT_DYNAMIC section with index 1 has invalid size (0x4){{$}}
# WARN-GNU: warning: '[[FILE]]': no valid dynamic table was found
# WARN-GNU-NEXT: ELF Header:
# WARN-GNU:      Symbol table '.symtab' contains 1 entries:
# WARN-GNU:        0:

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
Sections:
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1000
    Content: "01234567"
Symbols: []
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynamic
  - Type: PT_DYNAMIC
    VAddr: 0x1000
    Sections:
      - Section: .dynamic

## Test handling of a .dynamic section with an invalid entsize (i.e. not 2 * sizeof(Elf_Dyn)).
# RUN: yaml2obj %s --docnum=2 -o %t.bad-entsize
# RUN: llvm-readobj --dynamic-table %t.bad-entsize | FileCheck %s --check-prefix BAD-ENTSIZE-LLVM
# RUN: llvm-readelf --dynamic-table %t.bad-entsize | FileCheck %s --check-prefix BAD-ENTSIZE-GNU

# BAD-ENTSIZE-LLVM:      DynamicSection [ (2 entries)
# BAD-ENTSIZE-LLVM-NEXT:   Tag                Type                 Name/Value
# BAD-ENTSIZE-LLVM-NEXT:   0x0000000000000015 DEBUG                0x0
# BAD-ENTSIZE-LLVM-NEXT:   0x0000000000000000 NULL                 0x0
# BAD-ENTSIZE-LLVM-NEXT: ]

# BAD-ENTSIZE-GNU:      Dynamic section at offset 0x{{.*}} contains 2 entries:
# BAD-ENTSIZE-GNU-NEXT:   Tag                Type                 Name/Value
# BAD-ENTSIZE-GNU-NEXT:   0x0000000000000015 (DEBUG)              0x0
# BAD-ENTSIZE-GNU-NEXT:   0x0000000000000000 (NULL)               0x0

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
Sections:
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1000
    EntSize: 0x2
    Entries:
      - Tag:   DT_DEBUG
        Value: 0
      - Tag:   DT_NULL
        Value: 0
Symbols: []
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynamic
  - Type: PT_DYNAMIC
    VAddr: 0x1000
    Sections:
      - Section: .dynamic

## Test handling of string references pointing past the end of the dynamic string table.
# RUN: yaml2obj %s --docnum=3 -o %t.bad-string
# RUN: llvm-readobj --dynamic-table %t.bad-string 2>&1 | \
# RUN:   FileCheck %s --implicit-check-not=warning: --check-prefix BAD-STRING-LLVM -DFILE=%t.bad-string
# RUN: llvm-readelf --dynamic-table %t.bad-string 2>&1 | \
# RUN:   FileCheck %s --implicit-check-not=warning: --check-prefix BAD-STRING-GNU -DFILE=%t.bad-string

# BAD-STRING-LLVM:      warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM:      LoadName: <?>
# BAD-STRING-LLVM:      DynamicSection [ (10 entries)
# BAD-STRING-LLVM-NEXT:   Tag                Type      Name/Value
# BAD-STRING-LLVM-NEXT:   0x0000000000000005 STRTAB    0x1000
# BAD-STRING-LLVM-NEXT:   0x000000000000000A STRSZ     1 (bytes)
# BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb2: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM-NEXT:   0x0000000000000001 NEEDED    Shared library: [<?>]
# BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM-NEXT:   0x000000007FFFFFFF FILTER    Filter library: [<?>]
# BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM-NEXT:   0x000000007FFFFFFD AUXILIARY Auxiliary library: [<?>]
# BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM-NEXT:   0x000000007FFFFFFE USED      Not needed object: [<?>]
## Note: there is no "string table at offset 0xb0..." warning here, because it was printed earlier.
# BAD-STRING-LLVM-NEXT:   0x000000000000000E SONAME    Library soname: [<?>]
# BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb7: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM-NEXT:   0x000000000000000F RPATH     Library rpath: [<?>]
# BAD-STRING-LLVM-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb8: it goes past the end of the table (0xb1)
# BAD-STRING-LLVM-NEXT:   0x000000000000001D RUNPATH   Library runpath: [<?>]
# BAD-STRING-LLVM-NEXT:   0x0000000000000000 NULL      0x0
# BAD-STRING-LLVM-NEXT: ]

# BAD-STRING-GNU:      warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT: Dynamic section at offset 0xb1 contains 10 entries:
# BAD-STRING-GNU-NEXT:   Tag                Type        Name/Value
# BAD-STRING-GNU-NEXT:   0x0000000000000005 (STRTAB)    0x1000
# BAD-STRING-GNU-NEXT:   0x000000000000000a (STRSZ)     1 (bytes)
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb2: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT:   0x0000000000000001 (NEEDED)    Shared library: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT:   0x000000007fffffff (FILTER)    Filter library: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT:   0x000000007ffffffd (AUXILIARY) Auxiliary library: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT:   0x000000007ffffffe (USED)      Not needed object: [<?>]
## Note: there is no "string table at offset 0xb6..." warning here, because it was printed earlier.
# BAD-STRING-GNU-NEXT:   0x000000000000000e (SONAME)    Library soname: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb7: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT:   0x000000000000000f (RPATH)     Library rpath: [<?>]
# BAD-STRING-GNU-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb8: it goes past the end of the table (0xb1)
# BAD-STRING-GNU-NEXT:   0x000000000000001d (RUNPATH)   Library runpath: [<?>]
# BAD-STRING-GNU-NEXT:   0x0000000000000000 (NULL)      0x0

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
Sections:
  - Name:    .dynstr
    Type:    SHT_STRTAB
    Address: 0x1000
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1010
    Entries:
      - Tag:   DT_STRTAB
        Value: 0x1000
      - Tag:   DT_STRSZ
        Value: 1
      - Tag:   DT_NEEDED
        Value: 2
      - Tag:   DT_FILTER
        Value: 3
      - Tag:   DT_AUXILIARY
        Value: 4
      - Tag:   DT_USED
        Value: 5
      - Tag:   DT_SONAME
        Value: 6
      - Tag:   DT_RPATH
        Value: 7
      - Tag:   DT_RUNPATH
        Value: 8
      - Tag:   DT_NULL
        Value: 0
Symbols: []
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynstr
      - Section: .dynamic
  - Type: PT_DYNAMIC
    VAddr: 0x1010
    Sections:
      - Section: .dynamic

## Test handling of DT_STRTAB pointing outside the file's address space.
# RUN: yaml2obj %s --docnum=4 -o %t.bad-strtab

# RUN: llvm-readobj --dynamic-table %t.bad-strtab 2>&1 >/dev/null | \
# RUN:   FileCheck -DFILE=%t.bad-strtab %s --check-prefix BAD-STRTAB-ERR
# RUN: llvm-readelf --dynamic-table %t.bad-strtab 2>&1 >/dev/null | \
# RUN:   FileCheck -DFILE=%t.bad-strtab %s --check-prefix BAD-STRTAB-ERR
# BAD-STRTAB-ERR: warning: '[[FILE]]': Unable to parse DT_STRTAB: virtual address is not in any segment: 0x2000000
# BAD-STRTAB-ERR: warning: '[[FILE]]': string table was not found

# RUN: llvm-readobj --dynamic-table --needed-libs %t.bad-strtab 2>&1 | \
# RUN:   FileCheck -DFILE=%t.bad-strtab %s --check-prefixes=BAD-STRTAB-ERR,BAD-STRTAB,BAD-STRTAB-LLVM
# RUN: llvm-readelf --dynamic-table --needed-libs %t.bad-strtab 2>&1 | \
# RUN:   FileCheck -DFILE=%t.bad-strtab %s --check-prefixes=BAD-STRTAB-ERR,BAD-STRTAB,BAD-STRTAB-GNU

# BAD-STRTAB-LLVM: LoadName: <?>
# BAD-STRTAB-LLVM: 0x0000000000000001  NEEDED   Shared library: [<?>]
# BAD-STRTAB-GNU:  0x0000000000000001 (NEEDED)  Shared library: [<?>]
# BAD-STRTAB:      NeededLibraries [
# BAD-STRTAB:        <?>
# BAD-STRTAB:      ]

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
Sections:
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1000
    Entries:
      - Tag:   DT_STRTAB
        Value: 0x2000000
      - Tag:   DT_STRSZ
        Value: 10
      - Tag:   DT_NEEDED
        Value: 1
      - Tag:   DT_NULL
        Value: 0x0
Symbols: []
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynamic
  - Type: PT_DYNAMIC
    VAddr: 0x1000
    Sections:
      - Section: .dynamic

## Test handling of other d_ptr tags pointing outside the file's address space.
# RUN: yaml2obj %s --docnum=5 -o %t.bad-rela
# RUN: llvm-readobj --dynamic-table %t.bad-rela 2>&1 | FileCheck -DFILE=%t.bad-rela %s --check-prefixes=CHECK,BAD-RELA
# RUN: llvm-readelf --dynamic-table %t.bad-rela 2>&1 | FileCheck -DFILE=%t.bad-rela %s --check-prefixes=CHECK,BAD-RELA-GNU

# CHECK: warning: '[[FILE]]': Unable to parse DT_RELA: virtual address is not in any segment: 0x1000000

# BAD-RELA:      DynamicSection [ (2 entries)
# BAD-RELA-NEXT:   Tag                Type Name/Value
# BAD-RELA-NEXT:   0x0000000000000007 RELA 0x1000000
# BAD-RELA-NEXT:   0x0000000000000000 NULL 0x0
# BAD-RELA-NEXT: ]
# BAD-RELA-GNU:      Dynamic section at offset 0xb0 contains 2 entries:
# BAD-RELA-GNU-NEXT: Tag                Type   Name/Value
# BAD-RELA-GNU-NEXT: 0x0000000000000007 (RELA) 0x1000000
# BAD-RELA-GNU-NEXT: 0x0000000000000000 (NULL) 0x0

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
Sections:
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1000
    Entries:
      - Tag:   DT_RELA
        Value: 0x1000000
      - Tag:   DT_NULL
        Value: 0x0
Symbols: []
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynamic
  - Type: PT_DYNAMIC
    VAddr: 0x1000
    Sections:
      - Section: .dynamic

## Check how we handle cases when the dynamic string table is not null-terminated.

## Case A: the value of the DT_STRSZ tag is equal to the size of
##         the not null-terminated dynamic string table.
# RUN: yaml2obj %s -DSTRSZ=7 --docnum=6 -o %t6
# RUN: llvm-readobj --dynamic-table %t6 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t6 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ
# RUN: llvm-readelf --dynamic-table %t6 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t6 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ

## Case B: the value of the DT_STRSZ tag is less than the size of
##         the not null-terminated dynamic string table.
# RUN: yaml2obj %s -DSTRSZ=6 --docnum=6 -o %t7
# RUN: llvm-readobj --dynamic-table %t7 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t7 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LESS
# RUN: llvm-readelf --dynamic-table %t7 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t7 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-LESS

## Case C: the value of the DT_STRSZ tag is one byte larger than the size of
##         the not null-terminated dynamic string table.
# RUN: yaml2obj %s -DSTRSZ=8 --docnum=6 -o %t8
# RUN: llvm-readobj --dynamic-table %t8 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t8 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ
# RUN: llvm-readelf --dynamic-table %t8 2>&1 | \
# RUN:   FileCheck %s -DFILE=%t8 --implicit-check-not=warning: --check-prefixes=NOT-TERMINATED,NOT-TERMINATED-GREQ

# NOT-TERMINATED:      warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb4: the string table is not null-terminated
# NOT-TERMINATED:      warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb0: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}NEEDED{{[)]?}}    Shared library: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb1: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}FILTER{{[)]?}}    Filter library: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb2: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb3: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}USED{{[)]?}}      Not needed object: [<?>]
# NOT-TERMINATED-NEXT: {{[(]?}}SONAME{{[)]?}}    Library soname: [<?>]
# NOT-TERMINATED-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb5: the string table is not null-terminated
# NOT-TERMINATED-NEXT: {{[(]?}}RPATH{{[)]?}}     Library rpath: [<?>]
# NOT-TERMINATED-GREQ-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: the string table is not null-terminated
# NOT-TERMINATED-LESS-NEXT: warning: '[[FILE]]': string table at offset 0xb0: unable to read the string at 0xb6: it goes past the end of the table (0xb6)
# NOT-TERMINATED-NEXT: {{[(]?}}RUNPATH{{[)]?}}   Library runpath: [<?>]
# NOT-TERMINATED-NEXT: {{[(]?}}NULL{{[)]?}}      0x0

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
Sections:
  - Name:    .dynstr
    Type:    SHT_STRTAB
    Address: 0x1000
    Content: '746573742e736f' ## "test.so", not null terminated.
  - Type:    Fill
    Pattern: "61626300" ## 'a', 'b', 'c', '\0'.
    Size:    "4"
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1100
    Entries:
      - Tag:   DT_STRTAB
        Value: 0x1000
      - Tag:   DT_STRSZ
        Value: [[STRSZ]]
      - Tag:   DT_NEEDED
        Value: 0
      - Tag:   DT_FILTER
        Value: 1
      - Tag:   DT_AUXILIARY
        Value: 2
      - Tag:   DT_USED
        Value: 3
      - Tag:   DT_SONAME
        Value: 4
      - Tag:   DT_RPATH
        Value: 5
      - Tag:   DT_RUNPATH
        Value: 6
      - Tag:   DT_NULL
        Value: 0
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynstr
      - Section: .dynamic
  - Type: PT_DYNAMIC
    VAddr: 0x1100
    Sections:
      - Section: .dynamic

## Check that we emit an appropriate warning when the dynamic string table ends past the end of the file.

## Case A: the value of DT_STRSZ tag is set so that the string table ends
## right before the EOF. No warning should be emitted.
# RUN: yaml2obj %s -DSTRSZ=0x210 --docnum=6 -o %t9.1
# RUN: llvm-readobj --dynamic-table %t9.1 | \
# RUN:   FileCheck %s --implicit-check-not=warning: --check-prefix=BEFORE-THE-EOF
# RUN: llvm-readelf --dynamic-table %t9.1 | \
# RUN:   FileCheck %s --implicit-check-not=warning: --check-prefix=BEFORE-THE-EOF

## Note: The code reads the data in [DT_STRTAB, DT_STRTAB + DT_STRSZ] as the string table
## as normal. Since the file ends with a zero byte, strings are dumped, but if it didn't,
## we'd get <?> printed instead. The important bit is that we don't get the past the end warning.

# BEFORE-THE-EOF:      {{[(]?}}NEEDED{{[)]?}}    Shared library: [test.soabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}FILTER{{[)]?}}    Filter library: [est.soabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [st.soabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}USED{{[)]?}}      Not needed object: [t.soabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}SONAME{{[)]?}}    Library soname: [.soabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}RPATH{{[)]?}}     Library rpath: [soabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}RUNPATH{{[)]?}}   Library runpath: [oabc]
# BEFORE-THE-EOF-NEXT: {{[(]?}}NULL{{[)]?}}      0x0

## Case B: the value of DT_STRSZ tag is set so that the string table goes 1 byte past the EOF.
# RUN: yaml2obj %s -DSTRSZ=0x211 --docnum=6 -o %t9.2
# RUN: llvm-readobj --dynamic-table %t9.2 2>&1 | FileCheck %s -DFILE=%t9.2 --check-prefix=PAST-THE-EOF
# RUN: llvm-readelf --dynamic-table %t9.2 2>&1 | FileCheck %s -DFILE=%t9.2 --check-prefix=PAST-THE-EOF

# PAST-THE-EOF:      warning: '[[FILE]]': the dynamic string table at 0xb0 goes past the end of the file (0x2c0) with DT_STRSZ = 0x211
# PAST-THE-EOF:      warning: '[[FILE]]': string table was not found
# PAST-THE-EOF:      {{[(]?}}NEEDED{{[)]?}}    Shared library: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}FILTER{{[)]?}}    Filter library: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}AUXILIARY{{[)]?}} Auxiliary library: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}USED{{[)]?}}      Not needed object: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}SONAME{{[)]?}}    Library soname: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}RPATH{{[)]?}}     Library rpath: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}RUNPATH{{[)]?}}   Library runpath: [<?>]
# PAST-THE-EOF-NEXT: {{[(]?}}NULL{{[)]?}}      0x0