Issue |
91228
|
Summary |
__attribute__((nocf_check) on function pointer doesn't add notrack prefix with -O1+
|
Labels |
new issue
|
Assignees |
|
Reporter |
sroettger
|
I'm trying to use the nocf_check attribute on a function pointer by reproducing this testcase:
https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/X86/nocf_check.ll#L7
```
void __attribute__((nocf_check)) NoCfCheckFunc(void) {}
typedef void(*FuncPointer)(void);
void NoCfCheckCall(FuncPointer f) {
__attribute__((nocf_check)) FuncPointer p = (__attribute__((nocf_check)) FuncPointer) (f);
(*p)();
}
```
Compiling this with `-fcf-protection=branch` my expectation is that the call to `p` should have a `notrack` prefix.
This is the case, but only if I add `-O0`. Any higher optimization level results in a regular branch without the `notrack`.
https://godbolt.org/z/ocnz1qhbW
cc @MaskRay
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs