[LLD][ELF] - Convert symbol-index.s testcase to a YAML test case. NFCI.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 25 Apr 2019 15:08:52 +0000 (15:08 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 25 Apr 2019 15:08:52 +0000 (15:08 +0000)
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

lld/test/ELF/invalid/Inputs/symbol-index.elf [deleted file]
lld/test/ELF/invalid/bad-reloc-target.test
lld/test/ELF/invalid/symbol-index.s [deleted file]

diff --git a/lld/test/ELF/invalid/Inputs/symbol-index.elf b/lld/test/ELF/invalid/Inputs/symbol-index.elf
deleted file mode 100644 (file)
index f31ffbf..0000000
Binary files a/lld/test/ELF/invalid/Inputs/symbol-index.elf and /dev/null differ
index 4f42f1f..05aa2e5 100644 (file)
@@ -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
diff --git a/lld/test/ELF/invalid/symbol-index.s b/lld/test/ELF/invalid/symbol-index.s
deleted file mode 100644 (file)
index e3989b4..0000000
+++ /dev/null
@@ -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