criu/scripts/build
Kir Kolyshkin 0367a1f6fe Drop prefix from own memcpy/memset/memcmp
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 bdf6051
("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 8ea0ba7 ("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/198415449
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2017-02-06 13:29:54 +03:00
..
binfmt_misc Dockerfile: don't fail if a binfmt-misc rule already exists 2016-02-19 14:32:49 +03:00
Dockerfile.aarch64.hdr dockerfile: extract a common part in one file 2016-02-19 14:33:03 +03:00
Dockerfile.alpine build: install libnet-dev 2017-01-16 11:03:43 +03:00
Dockerfile.armv7hf.hdr dockerfile: extract a common part in one file 2016-02-19 14:33:03 +03:00
Dockerfile.ppc64le.hdr travis: enable compilation for ppc64le 2016-05-06 14:38:29 +03:00
Dockerfile.tmpl Drop prefix from own memcpy/memset/memcmp 2017-02-06 13:29:54 +03:00
Dockerfile.x86_64.hdr Dockerfile.x86_64: use Ubuntu Trusty 2016-11-02 20:35:57 +03:00
extract-deb-pkg Travis: fix yandex URL for packages 2016-08-01 16:51:05 +03:00
Makefile scripts/build aarch64-clang target: fix clang ver 2016-11-12 11:06:00 +03:00