[libc-commits] [PATCH] D115542: [libc] fix memcpy builtin looping
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Dec 10 11:25:42 PST 2021
sivachandra added inline comments.
================
Comment at: libc/cmake/modules/LLVMLibCLibraryRules.cmake:165
+ if(ADD_HEADER_COMPILE_OPTIONS)
+ target_compile_options(${interface_target_name} INTERFACE ${ADD_HEADER_COMPILE_OPTIONS})
+ endif()
----------------
Since header libraries are not listed as dependencies using `target_link_libraries`, this is not sufficient. However, we don't need this at all. Callers of `inline_memcpy`, which are not `memcpy`, can tolerate calls to `memcpy` from `inline_memcpy` - there is no recursive call to `memcpy`. Only `memcpy` should be built with `-fno-builtin-memcpy` as we don't want `inline_memcpy` in this case to call `memcpy` again.
================
Comment at: libc/src/string/memory_utils/elements.h:515
-#elif __has_builtin(__builtin_memcpy)
- __builtin_memcpy(dst, src, SIZE);
#else
----------------
This should be sufficient to fix the problem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115542/new/
https://reviews.llvm.org/D115542
More information about the libc-commits
mailing list