1 ## Test that NT_FILE sections in core files are interpreted correctly.
3 # RUN: yaml2obj %s -o %t.o
4 # RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU
5 # RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM
7 ## llvm-mc doesn't support generating ET_CORE files; the 'Content' field was
8 ## generated with the following steps:
9 # $ llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu tmp.s -o tmp.o
10 # $ bin/llvm-objcopy --dump-section=.note.foo=tmp.txt tmp.o /dev/null
11 # $ xxd -p tmp.txt | tr -d '\n'; echo
12 ## Using the following input:
13 # .section ".note.foo", "a"
15 # .long 5 /* namesz */
16 # .long end - begin /* descsz */
17 # .long 0x46494c45 /* type = NT_FILE */
21 # .quad 3 /* 3 file mappings */
22 # .quad 4096 /* page size */
23 # .quad 0x1000 /* start #1 */
24 # .quad 0x2000 /* end #1 */
25 # .quad 0x3000 /* offset #1 */
26 # .quad 0x4000 /* start #2 */
27 # .quad 0x5000 /* end #2 */
28 # .quad 0x6000 /* offset #2 */
29 # .quad 0x7000 /* start #3 */
30 # .quad 0x8000 /* end #3 */
31 # .quad 0x9000 /* offset #3 */
32 # .asciz "/path/to/a.out"
33 # .asciz "/path/to/libc.so"
46 Content: 0500000080000000454C4946434F524500000000030000000000000000100000000000000010000000000000002000000000000000300000000000000040000000000000005000000000000000600000000000000070000000000000008000000000000000900000000000002F706174682F746F2F612E6F7574002F706174682F746F2F6C6962632E736F005B737461636B5D00
52 # GNU: Displaying notes found
53 # GNU-NEXT: Owner Data size Description
54 # GNU-NEXT: CORE 0x00000080 NT_FILE (mapped files)
55 # GNU-NEXT: Page size: 4096
56 # GNU-NEXT: Start End Page Offset
57 # GNU-NEXT: 0x0000000000001000 0x0000000000002000 0x0000000000003000
58 # GNU-NEXT: /path/to/a.out
59 # GNU-NEXT: 0x0000000000004000 0x0000000000005000 0x0000000000006000
60 # GNU-NEXT: /path/to/libc.so
61 # GNU-NEXT: 0x0000000000007000 0x0000000000008000 0x0000000000009000
66 # LLVM-NEXT: NoteSection {
67 # LLVM-NEXT: Name: <?>
71 # LLVM-NEXT: Owner: CORE
72 # LLVM-NEXT: Data size: 0x80
73 # LLVM-NEXT: Type: NT_FILE (mapped files)
74 # LLVM-NEXT: Page Size: 4096
75 # LLVM-NEXT: Mapping [
76 # LLVM-NEXT: Start: 0x1000
77 # LLVM-NEXT: End: 0x2000
78 # LLVM-NEXT: Offset: 0x3000
79 # LLVM-NEXT: Filename: /path/to/a.out
81 # LLVM-NEXT: Mapping [
82 # LLVM-NEXT: Start: 0x4000
83 # LLVM-NEXT: End: 0x5000
84 # LLVM-NEXT: Offset: 0x6000
85 # LLVM-NEXT: Filename: /path/to/libc.so
87 # LLVM-NEXT: Mapping [
88 # LLVM-NEXT: Start: 0x7000
89 # LLVM-NEXT: End: 0x8000
90 # LLVM-NEXT: Offset: 0x9000
91 # LLVM-NEXT: Filename: [stack]