[PATCH] D25016: [ELF] - Fixed assert fail when symbol table has invalid sh_info value.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 28 05:47:01 PDT 2016
grimar updated this revision to Diff 72809.
grimar added a comment.
- Restored line removed by mistake at last minute.
https://reviews.llvm.org/D25016
Files:
ELF/Writer.cpp
test/ELF/Inputs/invalid-symtab-sh_info2.elf
test/ELF/invalid-elf.test
test/ELF/invalid-symtab-sh-info.s
Index: test/ELF/invalid-symtab-sh-info.s
===================================================================
--- test/ELF/invalid-symtab-sh-info.s
+++ test/ELF/invalid-symtab-sh-info.s
@@ -0,0 +1,8 @@
+# sh_info contains value greater than total amount of symbols.
+# RUN: not ld.lld %p/Inputs/invalid-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
+
+# sh_info contains invalid value saying non-local symbol is local.
+# RUN: not ld.lld %p/Inputs/invalid-symtab-sh_info2.elf -o %t2 2>&1 | \
+# RUN: FileCheck --check-prefix=INVALID-SYMTAB-SHINFO %s
Index: test/ELF/invalid-elf.test
===================================================================
--- test/ELF/invalid-elf.test
+++ test/ELF/invalid-elf.test
@@ -8,10 +8,6 @@
# RUN: FileCheck --check-prefix=INVALID-FILE-CLASS %s
# INVALID-FILE-CLASS: invalid file class: test.o
-# RUN: not ld.lld %p/Inputs/invalid-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/invalid-binding.elf -o %t2 2>&1 | \
# RUN: FileCheck --check-prefix=INVALID-BINDING %s
# INVALID-BINDING: unexpected binding
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -387,6 +387,8 @@
continue;
if (!includeInSymtab<ELFT>(*B))
continue;
+ if (!B->IsLocal)
+ fatal(getFilename(F) + ": invalid sh_info in symbol table");
StringRef SymName(StrTab + B->getNameOffset());
InputSectionBase<ELFT> *Sec = DR->Section;
if (!shouldKeepInSymtab<ELFT>(Sec, SymName, *B))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25016.72809.patch
Type: text/x-patch
Size: 1801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160928/d3836630/attachment.bin>
More information about the llvm-commits
mailing list