[clang] [clang] inherit GD to let the codegen add kcfi type for ifunc (PR #96400)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 14 12:14:38 PDT 2024


MaskRay wrote:

> The usual mechanism for emitting deferred definitions involves CodeGenModule::EmitDeferred(): declarations get added to the list by addDeferredDeclToEmit(), then it goes through to emit all the declarations on the list. So it's a matter of making sure the resolver ends up on the list. You should be able to look up the GlobalDecl from the mangled name using CodeGenModule::DeferredDecls, I think?

Created https://github.com/llvm/llvm-project/pull/98832 , which shall fix the problem.

This problem is less about deferred emission, but a normal `GetOrCreateLLVMFunction` `ForDefinition` call prematurely returns due to `llvm::Type *ResolverTy = llvm::GlobalIFunc::getResolverFunctionType(DeclTy)` and `(Entry->getValueType() == Ty)`

https://github.com/llvm/llvm-project/pull/96400


More information about the cfe-commits mailing list