Allow -fsanitize=function on all targets
authorFangrui Song <i@maskray.me>
Fri, 19 May 2023 14:59:37 +0000 (07:59 -0700)
committerFangrui Song <i@maskray.me>
Fri, 19 May 2023 14:59:37 +0000 (07:59 -0700)
commit67cbe1b8597272165c2529f8a14ec571abe29490
tree73b88c83746b05c751d00853be0c6bdffacdae56
parentad31a2dcadfcd57a99bbd6d0050d2690fd84a883
Allow -fsanitize=function on all targets

Functions instrumented with -fsanitize=function have two words before
the function label: a signature and a RTTI proxy.
Instrumented call sites check the signature first to skip checks
for uninstrumented callees.

The code is generic and works for all targets supporting C++ RTTI.
Change clangDriver to allow all targets. Add tests for Armv8.5
Branch Target Identification and `-fpatchable-function-entry=`.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D148573
13 files changed:
clang/docs/UndefinedBehaviorSanitizer.rst
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/FreeBSD.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/lib/Driver/ToolChains/NetBSD.cpp
clang/lib/Driver/ToolChains/Solaris.cpp
clang/test/CodeGen/ubsan-function.cpp
clang/test/Driver/fsanitize.c
compiler-rt/test/ubsan/TestCases/TypeCheck/Function/function.cpp
compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg.py
llvm/test/CodeGen/AArch64/func-sanitizer.ll [new file with mode: 0644]
llvm/test/CodeGen/AArch64/patchable-function-entry-bti.ll