[CRIU] [PATCH 2/3] ia32/feature-test: Don't check i686 libraries presence

Dmitry Safonov dsafonov at virtuozzo.com
Wed May 31 13:23:39 PDT 2017


I was adapting CRIU with ia32 support for building with Koji,
and found that Koji can't build x86_64 packages and have
i686 libs installed.
While at it, I found that i686 libraries requirement is
no longer valid since I've deleted the second parasite.

Drop feature test for i686 libs and put test for gcc.
That will effectively test if gcc can compile 32-bit code
and bug with debian's gcc (#315).

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 Makefile.config           |  8 +++++---
 scripts/feature-tests.mak | 41 ++++++++++++++++++++++++++++++++---------
 2 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/Makefile.config b/Makefile.config
index ec6c2d145142..0e557805c82a 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -21,12 +21,14 @@ $(CONFIG_FILE):
 
 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)
+ifeq ($(call try-asm,$(FEATURE_TEST_X86_COMPAT)),true)
         export CONFIG_COMPAT := y
         FEATURE_DEFINES	+= -DCONFIG_COMPAT
 else
-        $(info Note: Building without ia32 C/R, missed package(s):)
-        $(info $(info)      libc6-dev-i386 and/or gcc-multilib)
+        $(info Note: Building without ia32 C/R, missed ia32 support in gcc)
+        $(info $(info)      That may be related to missing gcc-multilib in your)
+        $(info $(info)      distribution or you may have Debian with buggy toolchain)
+        $(info $(info)      (issue https://github.com/xemul/criu/issues/315))
 endif
 endif
 
diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak
index ad50eb4ad892..12bf5418102c 100644
--- a/scripts/feature-tests.mak
+++ b/scripts/feature-tests.mak
@@ -90,13 +90,36 @@ 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;
-}
-
+#define __ALIGN         .align 4, 0x90
+#define ENTRY(name)             \
+        .globl name;            \
+        .type name, @function;  \
+        __ALIGN;                \
+        name:
+
+#define END(sym)                \
+        .size sym, . - sym
+
+#define __USER32_CS     0x23
+#define __USER_CS       0x33
+
+        .text
+
+ENTRY(call32_from_64)
+        /* Switch into compatibility mode */
+        pushq \$$__USER32_CS
+        pushq \$$1f
+        lretq
+1:
+        .code32
+        /* Run function and switch back */
+        call *%esi
+        jmp \$$__USER_CS,\$$1f
+        .code64
+1:
+END(call32_from_64)
+
+ENTRY(main)
+        nop
+END(main)
 endef
-- 
2.12.2



More information about the CRIU mailing list