diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2024-11-01 03:29:07 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 13:29:07 -0700 |
commit | 454abad7b0b995927f314842349a4db321e3b6b9 (patch) | |
tree | b69345710715275b0ec6aaecc594684b8b385cba /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | d183dc7c243cb9628d0015d4ed1a820ed802eff3 (diff) | |
download | llvm-454abad7b0b995927f314842349a4db321e3b6b9.zip llvm-454abad7b0b995927f314842349a4db321e3b6b9.tar.gz llvm-454abad7b0b995927f314842349a4db321e3b6b9.tar.bz2 |
[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()`.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions