Files
clang-p2996/llvm/lib/Transforms/IPO
Igor Kudrin 454abad7b0 [CFI][LowerTypeTests] Fix indirect call with alias (#113987)
This is a fixed version of #106185, which was reverted in #113978 due to
a buildbot failure.

Motivation example:
```
> cat test.cpp
extern "C" [[gnu::weak]] void f() {}
void alias() __attribute__((alias("f")));
int main() { auto p = alias; p(); }
> clang test.cpp -fsanitize=cfi-icall -flto=thin -fuse-ld=lld
> ./a.out
[1]    1868 illegal hardware instruction  ./a.out
```

If the address of a function was only taken through its alias, the
function was not considered exported and therefore was not included in
the CFI jumptable. This resulted in `@llvm.type.test()` being lowered to
`false`, and consequently the indirect call to the function was
eventually optimized to `ubsantrap()`.
2024-10-31 13:29:07 -07:00
..