[Verifier] Add verification logic for GlobalIFuncs
Verify that the resolver exists, that it is a defined Function, and that its return type matches the ifunc's type. Add corresponding check to BitcodeReader, change clang to emit the correct type, and fix tests to comply. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D112349
This commit is contained in:
committed by
Fangrui Song
parent
cf78715cae
commit
848812a55e
@@ -2279,7 +2279,11 @@ Error BitcodeReader::resolveGlobalAndIndirectSymbolInits() {
|
||||
return error("Alias and aliasee types don't match");
|
||||
GA->setAliasee(C);
|
||||
} else if (auto *GI = dyn_cast<GlobalIFunc>(GV)) {
|
||||
GI->setResolver(C);
|
||||
Type *ResolverFTy =
|
||||
GlobalIFunc::getResolverFunctionType(GI->getValueType());
|
||||
// Transparently fix up the type for compatiblity with older bitcode
|
||||
GI->setResolver(
|
||||
ConstantExpr::getBitCast(C, ResolverFTy->getPointerTo()));
|
||||
} else {
|
||||
return error("Expected an alias or an ifunc");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user