1 ## Test that malformed NT_FILE sections in core files are gracefully ignored.
3 ## llvm-mc doesn't support generating ET_CORE files; the 'Content' field in
4 ## each of the following test cases were generated with the following steps:
5 # $ llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu tmp.s -o tmp.o
6 # $ bin/llvm-objcopy --dump-section=.note.foo=tmp.txt tmp.o /dev/null
7 # $ xxd -p tmp.txt | tr -d '\n'; echo
8 # using the assembly shown with each test case.
10 # RUN: yaml2obj --docnum=1 %s -o %t1.o
11 # RUN: llvm-readelf -n %t1.o 2>&1 | FileCheck -DFILE=%t1.o %s --check-prefix=ERR-HEADER-SHORT
12 # ERR-HEADER-SHORT: warning: '[[FILE]]': malformed note: header too short
14 # .section ".note.foo", "a"
16 # .long 5 /* namesz */
17 # .long end - begin /* descsz */
18 # .long 0x46494c45 /* type = NT_FILE */
22 # .quad 0 /* no file mappings */
34 Content: 0500000008000000454C4946434F5245000000000000000000000000
40 # RUN: yaml2obj --docnum=2 %s -o %t2.o
41 # RUN: llvm-readelf -n %t2.o 2>&1 | FileCheck -DFILE=%t2.o %s --check-prefix=ERR-NULL-TERM
42 # ERR-NULL-TERM: warning: '[[FILE]]': malformed note: not NUL terminated
44 # .section ".note.foo", "a"
46 # .long 5 /* namesz */
47 # .long end - begin /* descsz */
48 # .long 0x46494c45 /* type = NT_FILE */
52 # .quad 1 /* 1 file mapping */
53 # .quad 4096 /* page size */
54 # .quad 0x1000 /* start #1 */
55 # .quad 0x2000 /* end #1 */
56 # .quad 0x3000 /* offset #1 */
69 Content: 050000002C000000454C4946434F5245000000000100000000000000001000000000000000100000000000000020000000000000003000000000000078787878
75 # RUN: yaml2obj --docnum=3 %s -o %t3.o
76 # RUN: llvm-readelf -n %t3.o 2>&1 | FileCheck -DFILE=%t3.o %s --check-prefix=ERR-FILE-COUNT
77 # ERR-FILE-COUNT: warning: '[[FILE]]': malformed note: too short for number of files
79 # .section ".note.foo", "a"
81 # .long 5 /* namesz */
82 # .long end - begin /* descsz */
83 # .long 0x46494c45 /* type = NT_FILE */
87 # .quad 2 /* 2 file mappings */
88 # .quad 4096 /* page size */
89 # .quad 0x1000 /* start #1 */
90 # .quad 0x2000 /* end #1 */
91 # .quad 0x3000 /* offset #1 */
104 Content: 050000002C000000454C4946434F5245000000000200000000000000001000000000000000100000000000000020000000000000003000000000000078797A00
110 # RUN: yaml2obj --docnum=4 %s -o %t4.o
111 # RUN: llvm-readelf -n %t4.o 2>&1 | FileCheck -DFILE=%t4.o %s --check-prefix=ERR-FILE-END-EARLY
112 # ERR-FILE-END-EARLY: warning: '[[FILE]]': malformed note: too few filenames
114 # .section ".note.foo", "a"
116 # .long 5 /* namesz */
117 # .long end - begin /* descsz */
118 # .long 0x46494c45 /* type = NT_FILE */
122 # .quad 2 /* 2 file mappings */
123 # .quad 4096 /* page size */
124 # .quad 0x1000 /* start #1 */
125 # .quad 0x2000 /* end #1 */
126 # .quad 0x3000 /* offset #1 */
127 # .quad 0x4000 /* start #2 */
128 # .quad 0x5000 /* end #2 */
129 # .quad 0x6000 /* offset #2 */
142 Content: 0500000044000000454C4946434F5245000000000200000000000000001000000000000000100000000000000020000000000000003000000000000000400000000000000050000000000000006000000000000078797A00