1. Move HOSTCC/HOSTLD to nmk (note there are rules in nmk
that make use of these variables already)
2. Make CC/LD derive from HOSTCC/HOSTLD
Note that one can still change anything from the command line.
travis-ci: success for build system: make CC/LD derive from HOSTCC/HOSTLD
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
clang-3.8 fails to compile inline asm having ldarx with 4 args.
Quoting [1]:
'''
Recent versions of the PowerPC architecture added a hint bit to the larx
instructions to differentiate between an atomic operation and a lock
operation:
> 0 Other programs might attempt to modify the word in storage addressed by EA
> even if the subsequent Store Conditional succeeds.
>
> 1 Other programs will not attempt to modify the word in storage addressed by
> EA until the program that has acquired the lock performs a subsequent
> store releasing the lock.
'''
I also found some more info about this in [2].
Anyway, we could either construct some preprocessor logic to omit this
argument for clang, or just drop it. This patch does the latter.
[1] https://patchwork.ozlabs.org/patch/45008/
[2] https://sourceware.org/ml/libc-alpha/2015-03/msg00085.html
travis-ci: success for PPC+clang compile fixes
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
For gcc, having "inline" is enough to suppress the "unused function"
warning. For clang, we have to do better than that.
See also: commit 4241078 ("zdtm: compile fix for clang") and
commit 3ea2fd7 ("crtools.c: fix compilation by clang").
travis-ci: success for PPC+clang compile fixes
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Right now struct mount_info only keeps the ext_mount_map for ->val
field. Since we're planning to switch onto --external engine we
won't have this struct and thus only char *is OK.
travis-ci: success for mnt: Deprecate --ext-mount-map for --external
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The same as for --ext-mount-map auto, but with manual key:val
setting in .desc file.
travis-ci: success for mnt: Deprecate --ext-mount-map for --external
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Setting GCOV environment variable is used for doing profiling (gcov).
Unfortunately, it is checked in two different ways:
1. In top Makefile and scripts/travis, it is checked against "1".
2. In other places, it's checked to be set to a non-empty value.
So, giving various values to GCOV will lead to different results.
Let's unify the approaches used. Apparently, among all the code the
easiest (and not too strict) way is to check for non-empty value
(this also leads to the smallest possible patch size).
Note that in Python, evaluating an empty string in a binary context
(such as after an "if" statement) equals to False.
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
With this patch, Travis will build/test CRIU using clang, for real.
I swear I fixed it before, but the fix was apparently lost.
travis-ci: success for series starting with [1/3] compel: mv noexecstack from CFLAGS to LDFLAGS
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Subprojects usually have own "asm" directory,
so to eliminate collision specify complete path.
travis-ci: success for common: Use complete path in inclusion
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Since in criu we can't choose proper
arch inside include statements (well,
it will simply require more ifdefs),
I generate include/common/asm symlink
to point proper architecture.
travis-ci: success for Common headers
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
In -dev branch the deps scheme is different as we have soccr and
compel bits there, so in master the criu vs piegen vs config
deps should look differently.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Done with python pprint module (indent = 4, width = 80)
for files with more than one field in and with length
exceeding 80 characters.
Travised-by: https://travis-ci.org/xemul/criu/jobs/171350152
travis-ci: success for zdtm: Split long .desc lines
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This is useful so that hooks can do a $(cat $pidfile) or [ -f $pidfile ]
and rely on the result.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
It-makes-sence-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This one will contain pid of the task living in a sub-ns and
waiting for the rest of the test to get daemonized.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Travised-by: https://travis-ci.org/xemul/criu/builds/170726663
I don't know why they were disabled, but they work fine.
travis-ci: success for travis: execute cgroup tests
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
On Ubuntu ppc64le, the libxt_standard.so is installed under a
different path.
Adding this path to the dependency list to make the test running on
ppc64le.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
With this, one can do a CRUI build via QEMU+Docker using clang
as a compiler, for example:
make -C scripts/build alpine-clang
make -C scripts/build ppc64le-clang
For alpine, default clang version is used. For others, a version has
to be specified explicitly, as there is no package called "clang" in
Ubuntu Trusty (which is used as a base for most arches). Since
clang-3.8 appears to be available from Trusty, and this is the current
stable version of clang, let's use it.
travis-ci: success for QEMU+Dockerfile improvements + clang build
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Let's use Ubuntu Trusty Tahr (aka 14.04) for x86_64 QEMU build, as
1. this is the version that is used for other QEMU arches;
2. Ubuntu Wily, used before, is EOL as of July 28, 2016.
travis-ci: success for QEMU+Dockerfile improvements + clang build
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
I just spent some considerable time trying to figure out the source
of errors like this:
make -C scripts/build ppc64
...
DEP images/autofs.pb-c.d
In file included from images/autofs.pb-c.c:9:0:
images/autofs.pb-c.h:7:35: fatal error: protobuf-c/protobuf-c.h:
No such file or directory
#include <protobuf-c/protobuf-c.h>
^
compilation terminated.
It appears that we copy the complete tree to a docker container, and it
is not cleaned properly before the build. In particular, images/*.pb-c.{c,h}
are not removed/rebuilt. The problem is not noticeable until version of
protobuf-c differs between the host and container, and they use different
include paths (/usr/include/google/protobuf-c/ vs /usr/include/protobuf-c).
As I don't want anyone else to spend so much time figuring this out,
here is the patch.
travis-ci: success for QEMU+Dockerfile improvements + clang build
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
git is needed as the top-level Makefile calls it. Strictly speaking
git is not required to build CRIU, but it's better to have it than
to see some error messages.
coreutils is needed for nproc utility which is called from Dockerfile:
make -j $(nproc)
Before this patch, it was equivalent to "make -j" (plus an error
message) which is not the best thing to do.
travis-ci: success for QEMU+Dockerfile improvements + clang build
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
We'll need this for the next bits and the series, and since dmpi doesn't
modify this or even use it the structure, it's safe.
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
A root mount namespace list is used to resolve paths to
unix sockets if they are placed on btrfs.
This patch fixes a crash:
#0 mount_resolve_path at criu/mount.c:213
#1 phys_stat_resolve_dev at criu/mount.c:240
#2 phys_stat_dev_match at criu/mount.c:256
#3 unix_process_name at criu/sk-unix.c:565
#4 unix_collect_one at criu/sk-unix.c:620
#5 unix_receive_one at criu/sk-unix.c:692
#6 nlmsg_receive at criu/libnetlink.c:45
#7 do_rtnl_req at criu/libnetlink.c:119
#8 do_collect_req at criu/sockets.c:610
#9 collect_sockets at criu/sockets.c:636
travis-ci: success for cr-check: fill up a root task mount namespace
https://bugzilla.redhat.com/show_bug.cgi?id=1381351
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
1. GCOV=0 is wrong, it should be left unset (or set to empty value)
2. GCOV=1 only makes sense for TR_ARCH=local, others are not using it
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
It contained definitions for F_{SET,GET}PIPE_SZ, which
we already have in "fcntl.h" - it's not big, can be included instead.
Also it has pipe-size specific definitions, which are used only
in page-pipe.c -- moved them to page-pipe.h.
This will simplify include for config.h from subprojects.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
So, we need CONFIG_HAS_* feature-defines in compel, libsoccr
tools. Let's move this tests upper.
It also reverts commit 411cde8815a4 ("make, soccr: let CRIU depend on
libsoccr"), as we don't need -lsoccr to build feature tests now.
To eliminate any races here, I added $(LIB_FEATURES).
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Otherwise, on some environments, GNU/Make may try to expand
implicit rules right in the top Makefile.
Fixes:
[criu]$ make criu/parasite-syscall.o
...
make -r -R -f /criu/scripts/nmk/scripts/main.mk makefile=Makefile obj=criu criu/parasite-syscall.c
make[1]: Entering directory `/criu'
make[1]: Nothing to be done for `criu/parasite-syscall.c'.
make[1]: Leaving directory `/criu'
gcc -O2 -g -Wall -Wformat-security -Werror -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -c -o criu/parasite-syscall.o criu/parasite-syscall.c
criu/parasite-syscall.c:8:22: fatal error: protobuf.h: No such file or directory
#include "protobuf.h"
^
compilation terminated.
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Removed `config' target, as it only has $(CONFIG_HEADER) dependency.
$(VERSION_HEADER) dependency is in top-make for CRIU's files:
> criu/%: images/built-in.o compel/compel $(VERSION_HEADER) .FORCE
Introduced pattern-specific target for CRIU files, so it
got as dependency pie (and config header as pie's deps).
As we're building from NMK and including source Makefile from there,
it adds Makefile dependency - tell GNU/Make, that it's all right,
up-to-date by introducing Makefile target (otherwise, Makefile
would fit pattern-specific rule).
For any PIE's object I just rebuild/regenerate all pie, it may
be smarter - but we have now Makefile.library and Makefile
for PIE, so need to know, who should rebuild it.
Fixes:
[criu]$ make criu/log.o
make[1]: Entering directory '/home/japdoll/tools/criu'
make[1]: Leaving directory '/home/japdoll/tools/criu'
make[1]: Entering directory '/home/japdoll/tools/criu'
make[1]: 'images/built-in.o' is up to date.
make[1]: Leaving directory '/home/japdoll/tools/criu'
make[1]: Entering directory '/home/japdoll/tools/criu'
make[1]: 'compel/compel' is up to date.
make[1]: Leaving directory '/home/japdoll/tools/criu'
make[1]: Entering directory '/home/japdoll/tools/criu'
DEP criu/log.d
In file included from criu/log.c:22:0:
/home/japdoll/tools/criu/criu/include/string.h:11:20: fatal error: config.h: No such file or directory
#include "config.h"
^
compilation terminated.
CC criu/log.o
In file included from criu/log.c:22:0:
/home/japdoll/tools/criu/criu/include/string.h:11:20: fatal error: config.h: No such file or directory
#include "config.h"
^
compilation terminated.
make[1]: *** [/home/japdoll/tools/criu/scripts/nmk/scripts/build.mk:104: criu/log.o] Error 1
make[1]: Leaving directory '/home/japdoll/tools/criu'
make: *** [Makefile:200: criu/log.o] Error 2
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
When compiling criu with clang, I discovered compilation fails like
this:
GEN criu/pie/restorer-blob.h
restorer_blob: Error (compel/src/lib/handle-elf-host.c:328): Unexpected
undefined symbol: `memcpy'. External symbol in PIE?
This happens because clang emits a call to memcpy for struct
initialization (specifically, struct vdso_symtable in vdso_proxify()).
Naturally, as pie is complied without libc there is no memcpy()
so "compel piegen" rightfully complains.
There are a number of possible solutions to that:
1. Write our own vdso_init_symtable() function instead of using =
2. Use some compiler flags that disables using memcpy
3. Provide own version of memcpy
Now, (1) looks ugly, (2) I was not able to find such flags. Another
argument in favor of (3) is we already have implementation of
builtin_memcpy() optimized for x86.
The only problem is it is not named memcpy(). Using assembler file (.S)
we can have a function with two names (entry points).
For a similar issue in ppc, see commits 0570dd8 and 1ad7817. Ultimately,
we should get rid of builtin_mem* names and just use memcpy(), memcmp()
etc, which in case of non-libc linked objects are to be provided by us.
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
(cherry picked from commit 214e28089e832d30e381b3780862d3309df17fb8)
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
The util.h it pretty big header, those who need utils
should include it explicitly. Right now some of them
only need xmalloc really.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>