• Kir Kolyshkin's avatar
    Drop prefix from own memcpy/memset/memcmp · 0367a1f6
    Kir Kolyshkin authored
    C compiler might generate calls to memcpy, memset, memcmp, and memmove
    as it seem fit (so far we haven't seen memmove being required). That
    means we need to provide our own versions of it for code which is not
    linked to a libc.
    
    We already have a solution for that in commit bdf60512
    ("pie: provide memcpy/memcmp/memset for noglibc case")
    but we faced another problem of compiler trying to optimize
    our builtin_memset() by inserting calls to memset() which
    is just an alias in our case and so it lead to infinite recursion.
    This was workarounded in commit 8ea0ba7d ("string.h: fix memset
    over-optimization with clang") but it's not clear that was a proper
    fix.
    
    This patch is considered to be the real solution. As we don't have
    any other implementations of memset/memcpy/memcmp in non-libc case,
    we can call ours without any prefixes and avoid using weak aliases.
    
    Implementation notes:
    
    1. mem*() functions code had to be moved from .h to .c for the functions
    to be compatible with their prototypes declared in /usr/include/string.h
    (i.e. "extern").
    
    2. FORTIFY_SOURCE needed to be disabled for code not linked to libc,
    because otherwise memcpy() may be replaced with a macro that expands
    to __memcpy_chk() which of course can't be resolved during linking.
    
    https://travis-ci.org/kolyshkin/criu/builds/198415449Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
    0367a1f6
Name
Last commit
Last update
Documentation Loading commit data...
contrib Loading commit data...
coredump Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
include/common Loading commit data...
lib Loading commit data...
scripts Loading commit data...
soccr Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.config Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...