[all-commits] [llvm/llvm-project] 921f87: Allow system header to provide their own implement...
serge-sans-paille via All-commits
all-commits at lists.llvm.org
Fri Jan 10 00:44:28 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 921f871ac438175ca8fcfcafdfcfac4d7ddf3905
https://github.com/llvm/llvm-project/commit/921f871ac438175ca8fcfcafdfcfac4d7ddf3905
Author: serge-sans-paille <sguelton at redhat.com>
Date: 2020-01-10 (Fri, 10 Jan 2020)
Changed paths:
M clang/include/clang/AST/Decl.h
M clang/lib/AST/Decl.cpp
M clang/lib/CodeGen/CGExpr.cpp
M clang/lib/CodeGen/CodeGenModule.cpp
A clang/test/CodeGen/memcpy-nobuiltin.c
A clang/test/CodeGen/memcpy-nobuiltin.inc
Log Message:
-----------
Allow system header to provide their own implementation of some builtin
If a system header provides an (inline) implementation of some of their
function, clang still matches on the function name and generate the appropriate
llvm builtin, e.g. memcpy. This behavior is in line with glibc recommendation «
users may not provide their own version of symbols » but doesn't account for the
fact that glibc itself can provide inline version of some functions.
It is the case for the memcpy function when -D_FORTIFY_SOURCE=1 is on. In that
case an inline version of memcpy calls __memcpy_chk, a function that performs
extra runtime checks. Clang currently ignores the inline version and thus
provides no runtime check.
This code fixes the issue by detecting functions whose name is a builtin name
but also have an inline implementation.
Differential Revision: https://reviews.llvm.org/D71082
More information about the All-commits
mailing list