[PATCH] D108479: [Clang] Add __builtin_addressof_nocfi

Sami Tolvanen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 20 12:00:00 PDT 2021


samitolvanen created this revision.
Herald added a subscriber: martong.
samitolvanen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This change adds __builtin_addressof_nocfi(). This built-in function
is similar to the existing __builtin_addressof(), except that with
-fsanitize=cfi, it returns the address of the function body instead of
a CFI jump table address.

__builtin_addressof_nocfi() is helpful in low-level code, such as
operating system kernels, which may need the address of a specific
function without a jump table indirection.

Link: https://github.com/ClangBuiltLinux/linux/issues/1353

Depends on D108478 <https://reviews.llvm.org/D108478>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108479

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/AST/APValue.h
  clang/include/clang/Basic/Builtins.def
  clang/lib/AST/APValue.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
  clang/test/CodeGen/builtin-addressof-nocfi.c
  clang/test/SemaCXX/builtins.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108479.367850.patch
Type: text/x-patch
Size: 7750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210820/c385777f/attachment.bin>


More information about the cfe-commits mailing list