5
5
# RUN: yaml2obj %s -o %t
6
6
# RUN: llvm-readelf --relocations --dyn-relocations %t | FileCheck %s
7
7
8
- # CHECK: Relocation section '.rela.text' at offset {{.*}} contains 2 entries:
8
+ # CHECK: Relocation section '.rela.text' at offset {{.*}} contains 3 entries:
9
9
# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
10
10
# CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
11
11
# CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
12
+ # CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 456
12
13
13
- # CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:
14
+ # CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 3 entries:
14
15
# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
15
16
# CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
16
17
# CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
18
+ # CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 456
17
19
18
20
# CHECK: 'RELA' relocation section at offset {{.*}} contains 48 bytes:
19
21
# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
20
22
# CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
21
23
# CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
22
-
23
- # TODO: Add test for symbol with no name but with a value once yaml2obj allows
24
- # referencing symbols with no name from relocations.
24
+ # CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 456
25
25
26
26
--- !ELF
27
27
FileHeader:
@@ -45,6 +45,10 @@ Sections:
45
45
Type: R_X86_64_NONE
46
46
Addend: 1
47
47
Symbol: sym
48
+ - Offset: 0
49
+ Type: R_X86_64_NONE
50
+ Addend: 0x456
51
+ Symbol: 2
48
52
- Name: .dynamic
49
53
Type: SHT_DYNAMIC
50
54
Flags: [SHF_ALLOC]
@@ -54,7 +58,7 @@ Sections:
54
58
- Tag: DT_RELA
55
59
Value: 0x1100
56
60
- Tag: DT_RELASZ
57
- Value: 48
61
+ Value: 72
58
62
- Tag: DT_RELAENT
59
63
Value: 24
60
64
- Tag: DT_NULL
@@ -73,16 +77,26 @@ Sections:
73
77
Type: R_X86_64_NONE
74
78
Addend: 1
75
79
Symbol: sym
80
+ - Offset: 0
81
+ Type: R_X86_64_NONE
82
+ Addend: 0x456
83
+ Symbol: 2
76
84
Symbols:
77
85
- Name: sym
78
86
Value: 0
79
87
Section: .text
80
88
Binding: STB_GLOBAL
89
+ - Value: 0x123
90
+ Section: .text
91
+ Binding: STB_GLOBAL
81
92
DynamicSymbols:
82
93
- Name: sym
83
94
Value: 0
84
95
Section: .text
85
96
Binding: STB_GLOBAL
97
+ - Value: 0x123
98
+ Section: .text
99
+ Binding: STB_GLOBAL
86
100
ProgramHeaders:
87
101
- Type: PT_LOAD
88
102
VAddr: 0x1000
0 commit comments