summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-04-25 15:08:52 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-04-25 15:08:52 +0000
commit44f2d74aa586afab6848ab370886e8c9eae8749a (patch)
treeae8369ace9e4d5bbb1948924e589641a414f52ce
parenta506fab189c1b0054272c50595e2ed998ae4929a (diff)
downloadbcm5719-llvm-44f2d74aa586afab6848ab370886e8c9eae8749a.tar.gz
bcm5719-llvm-44f2d74aa586afab6848ab370886e8c9eae8749a.zip
[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
-rw-r--r--lld/test/ELF/invalid/Inputs/symbol-index.elfbin480 -> 0 bytes
-rw-r--r--lld/test/ELF/invalid/bad-reloc-target.test25
-rw-r--r--lld/test/ELF/invalid/symbol-index.s10
3 files changed, 25 insertions, 10 deletions
diff --git a/lld/test/ELF/invalid/Inputs/symbol-index.elf b/lld/test/ELF/invalid/Inputs/symbol-index.elf
deleted file mode 100644
index f31ffbf602c..00000000000
--- a/lld/test/ELF/invalid/Inputs/symbol-index.elf
+++ /dev/null
Binary files differ
diff --git a/lld/test/ELF/invalid/bad-reloc-target.test b/lld/test/ELF/invalid/bad-reloc-target.test
index 4f42f1f8dcc..05aa2e5d6fa 100644
--- a/lld/test/ELF/invalid/bad-reloc-target.test
+++ b/lld/test/ELF/invalid/bad-reloc-target.test
@@ -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
index e3989b4e1ad..00000000000
--- a/lld/test/ELF/invalid/symbol-index.s
+++ /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
OpenPOWER on IntegriCloud