1## Check that a malformed NT_GNU_ABI_TAG note can be dumped without crashing.
2# RUN: yaml2obj %s -o %t
3# RUN: llvm-readelf --notes %t | FileCheck %s --check-prefix=GNU
4# RUN: llvm-readobj --elf-output-style LLVM --notes %t | FileCheck %s --check-prefix=LLVM
5## GNU binutils does not print the raw description data when encountering an
6## invalid NT_GNU_ABI_TAG, but in LLVM style we print it.
7
8# GNU:      Displaying notes found in: .note.ABI-tag
9# GNU-NEXT:   Owner                 Data size       Description
10# GNU-NEXT:   GNU                   0x00000004      NT_GNU_ABI_TAG (ABI version tag)
11# GNU-NEXT:     <corrupt GNU_ABI_TAG>
12# GNU-EMPTY:
13
14# LLVM:      Notes [
15# LLVM-NEXT:   NoteSection {
16# LLVM-NEXT:     Name: .note.ABI-tag
17# LLVM-NEXT:     Offset:
18# LLVM-NEXT:     Size: 0x14
19# LLVM-NEXT:     Note {
20# LLVM-NEXT:       Owner: GNU
21# LLVM-NEXT:       Data size: 0x4
22# LLVM-NEXT:       Type: NT_GNU_ABI_TAG (ABI version tag)
23# LLVM-NEXT:       ABI: <corrupt GNU_ABI_TAG>
24# LLVM-NEXT:       Description data (
25# LLVM-NEXT:         0000: 00000000 |....|
26# LLVM-NEXT:       )
27# LLVM-NEXT:     }
28# LLVM-NEXT:   }
29# LLVM-NEXT: ]
30
31--- !ELF
32FileHeader:
33  Class: ELFCLASS64
34  Data:  ELFDATA2LSB
35  Type:  ET_EXEC
36Sections:
37  - Name:            .note.ABI-tag
38    Type:            SHT_NOTE
39    AddressAlign:    0x0000000000000004
40    Content:         040000000400000001000000474E550000000000
41