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

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 2 19:28:09 PDT 2024


aokblast wrote:

The problem happens because ifunc can refer resolver that havn't been defined before ifunc attribute. But LLVM Function only add attribute when it constructed first time. So there are two possible path:

In the under case, no_sanitize cannot be add because it happens at ifunc("resolver") so the unit test failed
```c
func_t resolver() {
}

int foo(int) __attribute__ ((ifunc("resolver")));
```

In the under case, kcfi attribute failed to add because  it happens at function definition:

```c
int foo(int) __attribute__ ((ifunc("resolver")));

func_t resolver() {
}
```

I try to fix it but other error happens, here is the [patch file](https://pastebin.com/8DtXHpF1).

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


More information about the cfe-commits mailing list