[PATCH] D58780: [LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 02:58:19 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD355196: [LLD][ELF] - Convert 3 testcases to use yaml instead of binaries. (authored by grimar, committed by ).
Herald added a project: LLVM.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58780/new/
https://reviews.llvm.org/D58780
Files:
test/ELF/invalid/Inputs/symtab-sh_info.elf
test/ELF/invalid/Inputs/symtab-sh_info2.elf
test/ELF/invalid/Inputs/symtab-sh_info3.elf
test/ELF/invalid/invalid-elf.test
test/ELF/invalid/symtab-sh-info.s
Index: test/ELF/invalid/invalid-elf.test
===================================================================
--- test/ELF/invalid/invalid-elf.test
+++ test/ELF/invalid/invalid-elf.test
@@ -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
Index: test/ELF/invalid/symtab-sh-info.s
===================================================================
--- test/ELF/invalid/symtab-sh-info.s
+++ test/ELF/invalid/symtab-sh-info.s
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58780.188871.patch
Type: text/x-patch
Size: 3084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190301/3981880d/attachment.bin>
More information about the llvm-commits
mailing list