[COFF] Store import symbol pointers as pointers to the base class
authorMartin Storsjo <martin@martin.st>
Tue, 10 Jul 2018 10:40:11 +0000 (10:40 +0000)
committerMartin Storsjo <martin@martin.st>
Tue, 10 Jul 2018 10:40:11 +0000 (10:40 +0000)
commit474be005dbf5ee7fd658237f417192aad4696a4f
tree041ab9bb5cf7202481a18d46eeb611e111024c98
parentbc6702a42414f03ba2f83d4c1d417ca4d3b3bba7
[COFF] Store import symbol pointers as pointers to the base class

Future symbol insertions can potentially change the type of these
symbols - keep pointers to the base class to reflect this, and
use dynamic casts to inspect them before using as the subclass
type.

This fixes crashes that were possible before, by touching these
symbols that now are populated as e.g. a DefinedRegular, via
the old pointers with DefinedImportThunk type.

Differential Revision: https://reviews.llvm.org/D48953

llvm-svn: 336652
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/SymbolTable.cpp
lld/COFF/SymbolTable.h
lld/COFF/Writer.cpp
lld/test/COFF/Inputs/otherFunc.s [new file with mode: 0644]
lld/test/COFF/thunk-replace.s [new file with mode: 0644]