forked from OSchip/llvm-project
Diagnose symbols with invalid section indexes.
llvm-svn: 245884
This commit is contained in:
parent
744ad106c3
commit
5cd113df01
|
|
@ -93,6 +93,10 @@ SymbolBody *elf2::ObjectFile<ELFT>::createSymbolBody(StringRef StringTable,
|
|||
if (SecIndex == SHN_XINDEX)
|
||||
SecIndex = ELFObj->getExtendedSymbolTableIndex(Sym, Symtab, SymtabSHNDX);
|
||||
|
||||
if (SecIndex >= Chunks.size() ||
|
||||
(SecIndex != 0 && !Chunks[SecIndex]))
|
||||
error("Invalid section index");
|
||||
|
||||
switch (Sym->getBinding()) {
|
||||
default:
|
||||
error("unexpected binding");
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -13,3 +13,7 @@ INVALID-SYMTAB-SHINFO: Invalid sh_info in symbol table
|
|||
RUN: not lld -flavor gnu2 %p/Inputs/invalid-binding.elf -o %t2 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=INVALID-BINDING %s
|
||||
INVALID-BINDING: unexpected binding
|
||||
|
||||
RUN: not lld -flavor gnu2 %p/Inputs/invalid-section-index.elf -o %t2 2>&1 | \
|
||||
RUN: FileCheck --check-prefix=INVALID-SECTION-INDEX %s
|
||||
INVALID-SECTION-INDEX: Invalid section index
|
||||
|
|
|
|||
Loading…
Reference in New Issue