xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/gnu-note-size.test (revision ab930ee7cad8b8bf7968bb8d0c0d72524e2313c4)
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:      NoteSections [
15# LLVM-NEXT:   NoteSection {
16# LLVM-NEXT:     Name: .note.ABI-tag
17# LLVM-NEXT:     Offset:
18# LLVM-NEXT:     Size: 0x14
19# LLVM-NEXT:     Notes [
20# LLVM-NEXT:     {
21# LLVM-NEXT:       Owner: GNU
22# LLVM-NEXT:       Data size: 0x4
23# LLVM-NEXT:       Type: NT_GNU_ABI_TAG (ABI version tag)
24# LLVM-NEXT:       ABI: <corrupt GNU_ABI_TAG>
25# LLVM-NEXT:       Description data (
26# LLVM-NEXT:         0000: 00000000 |....|
27# LLVM-NEXT:       )
28# LLVM-NEXT:     }
29# LLVM-NEXT:    ]
30# LLVM-NEXT:   }
31# LLVM-NEXT: ]
32
33--- !ELF
34FileHeader:
35  Class: ELFCLASS64
36  Data:  ELFDATA2LSB
37  Type:  ET_EXEC
38Sections:
39  - Name:            .note.ABI-tag
40    Type:            SHT_NOTE
41    AddressAlign:    0x0000000000000004
42    Content:         040000000400000001000000474E550000000000
43