From 44f2d74aa586afab6848ab370886e8c9eae8749a Mon Sep 17 00:00:00 2001 From: George Rimar Date: Thu, 25 Apr 2019 15:08:52 +0000 Subject: [PATCH] [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 --- lld/test/ELF/invalid/Inputs/symbol-index.elf | Bin 480 -> 0 bytes lld/test/ELF/invalid/bad-reloc-target.test | 25 +++++++++++++++++++++++++ lld/test/ELF/invalid/symbol-index.s | 10 ---------- 3 files changed, 25 insertions(+), 10 deletions(-) delete mode 100644 lld/test/ELF/invalid/Inputs/symbol-index.elf delete mode 100644 lld/test/ELF/invalid/symbol-index.s 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 f31ffbf602c3b64f264d7598e599a441c4dbc891..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 480 zcmb<-^>JfjWMqH=Mg}_u1P><4z_0+pWN-kp9T-@#szg!H*bn0Hs0tKz49I`4UhX0Bc7PWB>pF diff --git a/lld/test/ELF/invalid/bad-reloc-target.test b/lld/test/ELF/invalid/bad-reloc-target.test index 4f42f1f..05aa2e5 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 e3989b4..0000000 --- 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 -- 2.7.4