dynamic-symbols.yaml
2.23 KB
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
## Ensures that implicitly added sections can be ordered within Sections.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj --sections %t1 | FileCheck %s --check-prefix=SECTION
# RUN: llvm-nm --dynamic %t1 | FileCheck %s --check-prefix=SYMBOL
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_WRITE ]
DynamicSymbols:
- Name: dynlocal
Type: STT_OBJECT
Section: .data
Binding: STB_LOCAL
- Name: dynglobal
Type: STT_OBJECT
Section: .data
Binding: STB_GLOBAL
- Name: dynweak
Type: STT_OBJECT
Section: .data
Binding: STB_WEAK
# SECTION: Name: .dynsym
# SECTION-NEXT: Type: SHT_DYNSYM
# SECTION-NEXT: Flags
# SECTION-NEXT: SHF_ALLOC
# SECTION: Name: .dynstr
# SECTION-NEXT: Type: SHT_STRTAB
# SECTION-NEXT: Flags
# SECTION-NEXT: SHF_ALLOC
# SYMBOL-DAG: d dynlocal
# SYMBOL-DAG: D dynglobal
# SYMBOL-DAG: V dynweak
## Check we can use numeric values to refer to sections.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: llvm-readobj --dyn-symbols %t2 2>&1 | FileCheck -DFILE=%t2 %s --check-prefix=NUM
# NUM: Name: foo
# NUM: Section:
# NUM-SAME: .data (0x1)
# NUM: Name: bar
# NUM: Section:
# NUM-SAME: .strtab (0x2)
# NUM: Name: zed
# NUM: warning: '[[FILE]]': invalid section index: 255
# NUM: Section:
# NUM-SAME: <?> (0xFF)
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .data
Type: SHT_PROGBITS
DynamicSymbols:
- Name: foo
Section: 1
- Name: bar
Section: 2
- Name: zed
Section: 0xff
## Check we report errors when unknown sections are referenced by dynamic symbols.
# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck -DFILE=%t3 %s --check-prefix=ERR
# ERR: error: unknown section referenced: '.sec1' by YAML symbol 'foo'
# ERR: error: unknown section referenced: '.sec2' by YAML symbol 'bar'
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Sections:
- Name: .data
Type: SHT_PROGBITS
DynamicSymbols:
- Name: foo
Section: .sec1
- Name: bar
Section: .sec2