Skip to content

Commit 44f2d74

Browse files
author
George Rimar
committed
[LLD][ELF] - Convert symbol-index.s testcase to a YAML test case. NFCI.
This removes one more binary object from the inputs and fixes the test case description. Previously it said that: "symbol-index.elf has incorrect type of .symtab section. There is no symbol bodies because of that and any symbol index becomes incorrect." But the real reason of the failture was not the incorrect type of a symbol table, but invalid index of the symbol used in a relocation, what happened because previous test tried to read .symtab as a SHT_RELA section. llvm-svn: 359197
1 parent a506fab commit 44f2d74

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed
-480 Bytes
Binary file not shown.

lld/test/ELF/invalid/bad-reloc-target.test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,28 @@ Sections:
4949
Symbols:
5050
- Name: foo
5151
Binding: STB_GLOBAL
52+
53+
## Relocation refers to a symbol with index larger than
54+
## symbol table size. Check we report it.
55+
# RUN: yaml2obj -docnum=3 %s -o %t2.o
56+
# RUN: not ld.lld %t2.o -o %t2 2>&1 | FileCheck %s --check-prefix=ERR3
57+
# ERR3: error: {{.*}}.o: invalid symbol index
58+
59+
--- !ELF
60+
FileHeader:
61+
Class: ELFCLASS64
62+
Data: ELFDATA2LSB
63+
Type: ET_REL
64+
Machine: EM_X86_64
65+
Sections:
66+
- Name: .text
67+
Type: SHT_PROGBITS
68+
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
69+
- Name: .rela.text
70+
Type: SHT_RELA
71+
Link: .symtab
72+
Info: .text
73+
Relocations:
74+
- Offset: 0x0000000000000000
75+
Symbol: 255
76+
Type: R_X86_64_64

lld/test/ELF/invalid/symbol-index.s

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)