Skip to content

Commit de1bef0

Browse files
author
George Rimar
committed
[llvm-readobj] - Fix a TODO in elf-reloc-zero-name-or-value.test.
The "TODO" mentioned was: "Add test for symbol with no name but with a value once yaml2obj allows referencing symbols with no name from relocations." We can do it now. Differential revision: https://reviews.llvm.org/D67609 llvm-svn: 372087
1 parent 6524a7a commit de1bef0

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

llvm/test/tools/llvm-readobj/elf-reloc-zero-name-or-value.test

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
# RUN: yaml2obj %s -o %t
66
# RUN: llvm-readelf --relocations --dyn-relocations %t | FileCheck %s
77

8-
# CHECK: Relocation section '.rela.text' at offset {{.*}} contains 2 entries:
8+
# CHECK: Relocation section '.rela.text' at offset {{.*}} contains 3 entries:
99
# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
1010
# CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
1111
# CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
12+
# CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 456
1213

13-
# CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 2 entries:
14+
# CHECK: Relocation section '.rela.dyn' at offset {{.*}} contains 3 entries:
1415
# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
1516
# CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
1617
# CHECK-NEXT: 0000000000000000 0000000100000000 R_X86_64_NONE 0000000000000000 sym + 1
18+
# CHECK-NEXT: 0000000000000000 0000000200000000 R_X86_64_NONE 0000000000000123 456
1719

1820
# CHECK: 'RELA' relocation section at offset {{.*}} contains 48 bytes:
1921
# CHECK-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
2022
# CHECK-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 1
2123
# 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
2525

2626
--- !ELF
2727
FileHeader:
@@ -45,6 +45,10 @@ Sections:
4545
Type: R_X86_64_NONE
4646
Addend: 1
4747
Symbol: sym
48+
- Offset: 0
49+
Type: R_X86_64_NONE
50+
Addend: 0x456
51+
Symbol: 2
4852
- Name: .dynamic
4953
Type: SHT_DYNAMIC
5054
Flags: [SHF_ALLOC]
@@ -54,7 +58,7 @@ Sections:
5458
- Tag: DT_RELA
5559
Value: 0x1100
5660
- Tag: DT_RELASZ
57-
Value: 48
61+
Value: 72
5862
- Tag: DT_RELAENT
5963
Value: 24
6064
- Tag: DT_NULL
@@ -73,16 +77,26 @@ Sections:
7377
Type: R_X86_64_NONE
7478
Addend: 1
7579
Symbol: sym
80+
- Offset: 0
81+
Type: R_X86_64_NONE
82+
Addend: 0x456
83+
Symbol: 2
7684
Symbols:
7785
- Name: sym
7886
Value: 0
7987
Section: .text
8088
Binding: STB_GLOBAL
89+
- Value: 0x123
90+
Section: .text
91+
Binding: STB_GLOBAL
8192
DynamicSymbols:
8293
- Name: sym
8394
Value: 0
8495
Section: .text
8596
Binding: STB_GLOBAL
97+
- Value: 0x123
98+
Section: .text
99+
Binding: STB_GLOBAL
86100
ProgramHeaders:
87101
- Type: PT_LOAD
88102
VAddr: 0x1000

0 commit comments

Comments
 (0)