[lld] r359197 - [LLD][ELF] - Convert symbol-index.s testcase to a YAML test case. NFCI.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 08:08:52 PDT 2019
Author: grimar
Date: Thu Apr 25 08:08:52 2019
New Revision: 359197
URL: http://llvm.org/viewvc/llvm-project?rev=359197&view=rev
Log:
[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.
Removed:
lld/trunk/test/ELF/invalid/Inputs/symbol-index.elf
lld/trunk/test/ELF/invalid/symbol-index.s
Modified:
lld/trunk/test/ELF/invalid/bad-reloc-target.test
Removed: lld/trunk/test/ELF/invalid/Inputs/symbol-index.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/Inputs/symbol-index.elf?rev=359196&view=auto
==============================================================================
Binary file - no diff available.
Modified: lld/trunk/test/ELF/invalid/bad-reloc-target.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/bad-reloc-target.test?rev=359197&r1=359196&r2=359197&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid/bad-reloc-target.test (original)
+++ lld/trunk/test/ELF/invalid/bad-reloc-target.test Thu Apr 25 08:08:52 2019
@@ -49,3 +49,28 @@ Sections:
Symbols:
- Name: foo
Binding: STB_GLOBAL
+
+## Relocation refers to a symbol with index larger than
+## symbol table size. Check we report it.
+# RUN: yaml2obj -docnum=3 %s -o %t2.o
+# RUN: not ld.lld %t2.o -o %t2 2>&1 | FileCheck %s --check-prefix=ERR3
+# ERR3: error: {{.*}}.o: invalid symbol index
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ - Name: .rela.text
+ Type: SHT_RELA
+ Link: .symtab
+ Info: .text
+ Relocations:
+ - Offset: 0x0000000000000000
+ Symbol: 255
+ Type: R_X86_64_64
Removed: lld/trunk/test/ELF/invalid/symbol-index.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/symbol-index.s?rev=359196&view=auto
==============================================================================
--- lld/trunk/test/ELF/invalid/symbol-index.s (original)
+++ lld/trunk/test/ELF/invalid/symbol-index.s (removed)
@@ -1,10 +0,0 @@
-## symbol-index.elf has incorrect type of .symtab section.
-## There is no symbol bodies because of that and any symbol index becomes incorrect.
-## Section Headers:
-## [Nr] Name Type Address Off Size ES Flg Lk Inf Al
-## [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
-## ...
-## [ 4] .symtab RELA 0000000000000000 000048 000030 18 1 2 8
-# RUN: not ld.lld %p/Inputs/symbol-index.elf -o /dev/null 2>&1 | \
-# RUN: FileCheck --check-prefix=INVALID-SYMBOL-INDEX %s
-# INVALID-SYMBOL-INDEX: invalid symbol index
More information about the llvm-commits
mailing list