[PATCH] D92657: Fix interaction between clang and some inline builtins from glibc under _FORTIFY_SOURCE
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 5 14:59:37 PDT 2021
efriedma added a comment.
I'm not really happy with this approach. I'm concerned at the IR level about functions that appear to be recursive, but aren't really supposed to recurse.
I'd recommend teaching clang to rename the inline function. So in the LLVM IR, you have the definition of the inline (with internal linkage), and the declaration of the external function. Then the users refer to the actual function they want (either the inline, or the original), depending on the context. If it's a recursive call, or not a call, refer to the external declaration. If it's a call, it refers to the inline function. That makes the semantics of the IR obvious, and preserves the intended functionality.
(gcc can make the choice to inline after certain optimizations run, so it can optimize certain edge cases involving function pointers to library functions. But that's unlikely to matter for normal usage.)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92657/new/
https://reviews.llvm.org/D92657
More information about the llvm-commits
mailing list