File: gnu-notes.test

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,388 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (164 lines) | stat: -rw-r--r-- 5,255 bytes parent folder | download | duplicates (2)
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
## Test tools are able to dump different types of notes.

# RUN: yaml2obj --docnum=1 %s > %t1.so
# RUN: llvm-readelf --notes %t1.so | FileCheck %s --check-prefix=GNU
# RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM

# GNU:      Displaying notes found at file offset 0x00000200 with length 0x00000020:
# GNU-NEXT:   Owner                 Data size       Description
# GNU-NEXT:   GNU                   0x00000010      NT_GNU_ABI_TAG (ABI version tag)
# GNU-NEXT:     OS: Linux, ABI: 2.6.32

# GNU:      Displaying notes found at file offset 0x00000220 with length 0x00000020:
# GNU-NEXT:   Owner                 Data size       Description
# GNU-NEXT:   GNU                  0x00000010       NT_GNU_BUILD_ID (unique build ID bitstring)
# GNU-NEXT:     Build ID: 4fcb712aa6387724a9f465a32cd8c14b

# GNU:      Displaying notes found at file offset 0x00000240 with length 0x0000001c:
# GNU-NEXT:   Owner                 Data size       Description
# GNU-NEXT:   GNU                  0x00000009       NT_GNU_GOLD_VERSION (gold version)
# GNU-NEXT:     Version: gold 1.11

# LLVM:      Notes [
# LLVM-NEXT:   NoteSection {
# LLVM-NEXT:     Offset: 0x200
# LLVM-NEXT:     Size: 0x20
# LLVM-NEXT:     Note {
# LLVM-NEXT:       Owner: GNU
# LLVM-NEXT:       Data size: 0x10
# LLVM-NEXT:       Type: NT_GNU_ABI_TAG (ABI version tag)
# LLVM-NEXT:       OS: Linux
# LLVM-NEXT:       ABI: 2.6.32
# LLVM-NEXT:     }
# LLVM-NEXT:   }
# LLVM-NEXT:   NoteSection {
# LLVM-NEXT:     Offset: 0x220
# LLVM-NEXT:     Size: 0x20
# LLVM-NEXT:     Note {
# LLVM-NEXT:       Owner: GNU
# LLVM-NEXT:       Data size: 0x10
# LLVM-NEXT:       Type: NT_GNU_BUILD_ID (unique build ID bitstring)
# LLVM-NEXT:       Build ID: 4fcb712aa6387724a9f465a32cd8c14b
# LLVM-NEXT:     }
# LLVM-NEXT:   }
# LLVM-NEXT:   NoteSection {
# LLVM-NEXT:     Offset: 0x240
# LLVM-NEXT:     Size: 0x1C
# LLVM-NEXT:     Note {
# LLVM-NEXT:       Owner: GNU
# LLVM-NEXT:       Data size: 0x9
# LLVM-NEXT:       Type: NT_GNU_GOLD_VERSION (gold version)
# LLVM-NEXT:       Version: gold 1.11
# LLVM-NEXT:     }
# LLVM-NEXT:   }
# LLVM-NEXT: ]

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:         .note.ABI-tag
    Type:         SHT_NOTE
    AddressAlign: 0x0000000000000004
    Content:      040000001000000001000000474E550000000000020000000600000020000000
  - Name:         .note.gnu.build-id
    Type:         SHT_NOTE
    Flags:        [ SHF_ALLOC ]
    Address:      0x0000000000400120
    AddressAlign: 0x0000000000000004
    Content:      040000001000000003000000474E55004FCB712AA6387724A9F465A32CD8C14B
  - Name:         .note.gnu.gold-version
    Type:         SHT_NOTE
    AddressAlign: 0x0000000000000004
    Content:      040000000900000004000000474E5500676F6C6420312E3131000000

## Test tools report an error if a note section has an invalid offset
## that goes past the end of file.

# RUN: yaml2obj --docnum=2 %s > %t2.so
# RUN: not llvm-readelf --notes %t2.so 2>&1 | FileCheck %s --check-prefix=ERR1
# RUN: not llvm-readobj --notes %t2.so 2>&1 | FileCheck %s --check-prefix=ERR1

# ERR1: error: SHT_NOTE section [index 1] has invalid offset (0xffff0000) or size (0x0)

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:     .note
    Type:     SHT_NOTE
    ShOffset: 0xffff0000

## Test tools report an error if a note section has invalid size
## that goes past the end of file.

# RUN: yaml2obj --docnum=3 %s > %t3.so
# RUN: not llvm-readelf --notes %t3.so 2>&1 | FileCheck %s --check-prefix=ERR2
# RUN: not llvm-readobj --notes %t3.so 2>&1 | FileCheck %s --check-prefix=ERR2

# ERR2: error: SHT_NOTE section [index 1] has invalid offset (0x180) or size (0xffff0000)

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:   .note
    Type:   SHT_NOTE
    ShSize: 0xffff0000

## Test tools report an error if a note program header has an invalid offset that
## goes past the end of file.

# RUN: yaml2obj --docnum=4 %s > %t4.so
# RUN: not llvm-readelf --notes %t4.so 2>&1 | FileCheck %s --check-prefix=ERR3
# RUN: not llvm-readobj --notes %t4.so 2>&1 | FileCheck %s --check-prefix=ERR3

# ERR3: error: PT_NOTE header has invalid offset (0xffff0000) or size (0x0)

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_CORE
  Machine: EM_X86_64
Sections:
  - Name: .note
    Type: SHT_NOTE
ProgramHeaders:
  - Type: PT_NOTE
    Offset: 0xffff0000
    Sections:
      - Section: .note

## Test tools report an error if a note program header has an invalid size that
## goes past the end of file.

# RUN: yaml2obj --docnum=5 %s > %t5.so
# RUN: not llvm-readelf --notes %t5.so 2>&1 | FileCheck %s --check-prefix=ERR4
# RUN: not llvm-readobj --notes %t5.so 2>&1 | FileCheck %s --check-prefix=ERR4

# ERR4: error: PT_NOTE header has invalid offset (0x1b8) or size (0xffff0000)

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_CORE
  Machine: EM_X86_64
Sections:
  - Name: .note
    Type: SHT_NOTE
ProgramHeaders:
  - Type: PT_NOTE
    FileSize: 0xffff0000
    Sections:
      - Section: .note