[CRIU] [PATCHv2 8/9] feature-test: add CONFIG_COMPAT compile option
Dmitry Safonov
dsafonov at virtuozzo.com
Thu Aug 4 08:07:48 PDT 2016
I'll wrap all compatible code in this CONFIG_COMPAT define.
As I'll wrap also compatible parasite generation in this,
it's also makefile variable, rather than just C define.
The test itself consists of including stubs-32.h, which is
glibc6-i686 presence test and is compiled with -m32 option,
which is test for gcc-multilib.
Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Cc: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/Makefile.config | 8 ++++++++
criu/arch/x86/include/asm/restorer.h | 1 -
scripts/feature-tests.mak | 12 ++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/criu/Makefile.config b/criu/Makefile.config
index f531b3b3c7bb..73ba0059d1ba 100644
--- a/criu/Makefile.config
+++ b/criu/Makefile.config
@@ -12,6 +12,14 @@ ifeq ($(call pkg-config-check,libselinux),y)
FEATURE_DEFINES += -DCONFIG_HAS_SELINUX
endif
+ifeq ($(SRCARCH),x86)
+# CONFIG_COMPAT is only for x86 now, no need for compile-test other archs
+ifeq ($(call try-cc,$(FEATURE_TEST_X86_COMPAT),-m32),true)
+ export CONFIG_COMPAT := y
+ FEATURE_DEFINES += -DCONFIG_COMPAT
+endif
+endif
+
export DEFINES += $(FEATURE_DEFINES)
export CFLAGS += $(FEATURE_DEFINES)
diff --git a/criu/arch/x86/include/asm/restorer.h b/criu/arch/x86/include/asm/restorer.h
index 65af6cd86405..a124dd2a6293 100644
--- a/criu/arch/x86/include/asm/restorer.h
+++ b/criu/arch/x86/include/asm/restorer.h
@@ -97,7 +97,6 @@ static inline void __always_unused __check_compat_sigset_t(void)
BUILD_BUG_ON(sizeof(compat_sigset_t) != sizeof(k_rtsigset_t));
}
-#define CONFIG_COMPAT
extern void *alloc_compat_syscall_stack(void);
extern void free_compat_syscall_stack(void *mem);
extern unsigned long call32_from_64(void *stack, void *func);
diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak
index 09bbdc815f88..ad50eb4ad892 100644
--- a/scripts/feature-tests.mak
+++ b/scripts/feature-tests.mak
@@ -88,3 +88,15 @@ int main(int argc, char *argv[], char *envp[])
}
endef
+
+define FEATURE_TEST_X86_COMPAT
+
+/* Test for glibc-devel.i686 presence */
+#include <gnu/stubs-32.h>
+
+int main(int argc, char **argv)
+{
+ return 0;
+}
+
+endef
--
2.9.0
More information about the CRIU
mailing list