[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
Tue Jul 9 22:47:20 PDT 2024
MaskRay wrote:
> Oh, hmm, I see.
>
> Maybe the right strategy here is to delay attaching the resolver to the ifunc until the end of the translation unit, when we know the definition is already emitted. That way, it should already have the right attributes. (We already do some delayed checking on aliases/ifuncs anyway, in checkAliasedGlobal().)
@efriedma-quic I've tried your suggestion: move `setResolver` to `checkAliasedGlobal`. However, I've run into some difficulty. When `EmitGlobal(foo)` is called, how to mark `resolver` as eagerly emitted? (Otherwise, `resolver` would not be emitted at all.)
```c
int foo(int) __attribute__ ((ifunc("resolver")));
static void *resolver(void) { return 0; } // MustBeEmitted(Global) return false
```
https://github.com/llvm/llvm-project/pull/96400
More information about the cfe-commits
mailing list