[lld] r355196 - [LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 02:58:45 PST 2019
Author: grimar
Date: Fri Mar 1 02:58:45 2019
New Revision: 355196
URL: http://llvm.org/viewvc/llvm-project?rev=355196&view=rev
Log:
[LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.
This change makes 3 tests to use yaml instead of binaries.
Differential revision: https://reviews.llvm.org/D58780
Removed:
lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info.elf
lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info2.elf
lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info3.elf
Modified:
lld/trunk/test/ELF/invalid/invalid-elf.test
lld/trunk/test/ELF/invalid/symtab-sh-info.s
Removed: lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info.elf?rev=355195&view=auto
==============================================================================
Binary file - no diff available.
Removed: lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info2.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info2.elf?rev=355195&view=auto
==============================================================================
Binary file - no diff available.
Removed: lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info3.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/Inputs/symtab-sh_info3.elf?rev=355195&view=auto
==============================================================================
Binary file - no diff available.
Modified: lld/trunk/test/ELF/invalid/invalid-elf.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/invalid-elf.test?rev=355196&r1=355195&r2=355196&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid/invalid-elf.test (original)
+++ lld/trunk/test/ELF/invalid/invalid-elf.test Fri Mar 1 02:58:45 2019
@@ -9,10 +9,6 @@
# RUN: FileCheck --check-prefix=INVALID-FILE-CLASS %s
# INVALID-FILE-CLASS: test.o: invalid file class
-# RUN: not ld.lld %p/Inputs/symtab-sh_info.elf -o %t2 2>&1 | \
-# RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s
-# INVALID-SYMTAB-SHINFO: invalid sh_info in symbol table
-
# RUN: not ld.lld %p/Inputs/binding.elf -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-BINDING %s
# INVALID-BINDING: unexpected binding
Modified: lld/trunk/test/ELF/invalid/symtab-sh-info.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/symtab-sh-info.s?rev=355196&r1=355195&r2=355196&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid/symtab-sh-info.s (original)
+++ lld/trunk/test/ELF/invalid/symtab-sh-info.s Fri Mar 1 02:58:45 2019
@@ -1,9 +1,59 @@
-## sh_info contains zero value. First entry in a symbol table is always completely zeroed,
-## so sh_info should be at least 1 in a valid ELF.
-# RUN: not ld.lld %p/Inputs/symtab-sh_info2.elf -o %t2 2>&1 | FileCheck %s
-# CHECK: invalid sh_info in symbol table
+## .symtab's sh_info contains zero value. First entry in a .symtab is a
+## zero entry that must exist in a valid object, so sh_info can't be null.
+## Check we report a proper error for that case.
+# RUN: yaml2obj -docnum=1 %s -o %t.o
+# RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck %s --check-prefix=ERR1
+# ERR1: invalid sh_info in symbol table
-## sh_info contains invalid value saying non-local symbol is local.
-# RUN: not ld.lld %p/Inputs/symtab-sh_info3.elf -o %t2 2>&1 | \
-# RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s
-# INVALID-SYMTAB-SHINFO: broken object: getLocalSymbols returns a non-local symbol
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .symtab
+ Info: 0
+ Type: SHT_SYMTAB
+Symbols:
+ Global:
+ - Name: foo
+
+## sh_info has value 2 what says that non-local symbol `foo` is local.
+## Check we report this case.
+# RUN: yaml2obj -docnum=2 %s -o %t.o
+# RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck --check-prefix=ERR2 %s
+# ERR2: broken object: getLocalSymbols returns a non-local symbol
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .symtab
+ Info: 2
+ Type: SHT_SYMTAB
+Symbols:
+ Global:
+ - Name: foo
+
+## sh_info has value 0xff what is larger than number of symbols in a .symtab.
+## Check we report this case.
+# RUN: yaml2obj -docnum=3 %s -o %t.o
+# RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck --check-prefix=ERR1 %s
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .symtab
+ Info: 0xff
+ Type: SHT_SYMTAB
+Symbols:
+ Global:
+ - Name: foo
More information about the llvm-commits
mailing list