[CRIU] [RFC PATCHv2 09/32] zdtm: reuse criu's compiler.h

Ivan Shapovalov intelfx at intelfx.name
Sat Mar 12 00:42:08 PST 2016


Signed-off-by: Ivan Shapovalov <intelfx at intelfx.name>
---
 test/zdtm/Makefile.inc           |  2 +-
 test/zdtm/lib/Makefile           |  2 +-
 test/zdtm/lib/include/compiler.h |  1 +
 test/zdtm/lib/zdtmtst.h          | 11 ++---------
 test/zdtm/static/Makefile        |  3 ++-
 test/zdtm/static/fpu01.c         | 10 ++++------
 6 files changed, 11 insertions(+), 18 deletions(-)
 create mode 120000 test/zdtm/lib/include/compiler.h

diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
index 074e39b..9993d15 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -18,7 +18,7 @@ endif
 
 SRCARCH ?= $(ARCH)
 
-CPPFLAGS += -iquote $(LIBDIR)/arch/$(SRCARCH)/include
+CPPFLAGS += -iquote $(LIBDIR)/include -iquote $(LIBDIR)/arch/$(SRCARCH)/include
 
 ifeq ($(strip $(V)),)
 	E = @echo
diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
index 592d934..8f89fd9 100644
--- a/test/zdtm/lib/Makefile
+++ b/test/zdtm/lib/Makefile
@@ -1,6 +1,6 @@
 include ../Makefile.inc
 
-CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fPIC
 CFLAGS	+= $(USERCFLAGS)
 
 LIBDIR	= .
diff --git a/test/zdtm/lib/include/compiler.h b/test/zdtm/lib/include/compiler.h
new file mode 120000
index 0000000..2743f56
--- /dev/null
+++ b/test/zdtm/lib/include/compiler.h
@@ -0,0 +1 @@
+../../../../criu/include/compiler.h
\ No newline at end of file
diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index 1afad70..c49d5a1 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -4,6 +4,8 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include "compiler.h"
+
 #ifndef PAGE_SIZE
 # define PAGE_SIZE (unsigned int)(sysconf(_SC_PAGESIZE))
 #endif
@@ -98,15 +100,6 @@ extern int write_pidfile(int pid);
 #include <errno.h>
 #include <string.h>
 
-#define __stringify_1(x)        #x
-#define __stringify(x)          __stringify_1(x)
-
-/*
- * Macro to define stack alignment. 
- * aarch64 requires stack to be aligned to 16 bytes.
- */
-#define __stack_aligned__	__attribute__((aligned(16)))
-
 /* message helpers */
 extern int test_log_init(const char *outfile, const char *suffix);
 extern int zdtm_seccomp;
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 7817e00..9453899 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -3,8 +3,9 @@ include ../Makefile.inc
 LIBDIR	= ../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
 override CPPFLAGS += -I$(LIBDIR)
-CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fPIC
 CFLAGS	+= $(USERCFLAGS)
+LDFLAGS = -fPIC -pie -rdynamic
 
 TST_NOFILE	=				\
 		busyloop00			\
diff --git a/test/zdtm/static/fpu01.c b/test/zdtm/static/fpu01.c
index c8e6ca1..704b768 100644
--- a/test/zdtm/static/fpu01.c
+++ b/test/zdtm/static/fpu01.c
@@ -30,16 +30,14 @@ static int verify_cpu(void)
 	return 0;
 }
 
-#define __aligned __attribute__((aligned(64)))
-
 /*
  * These are random strings generated by pwgen.
  */
-static __aligned unsigned char ymm1[32 + 1] = "code9Ee5sohphie1ae1kaeMahngoh5oe";
-static __aligned unsigned char ymm2[32 + 1] = "Tacuthahhien9Fi7aGhaa5toGh6vi7Ch";
+static __aligned(64) unsigned char ymm1[32 + 1] = "code9Ee5sohphie1ae1kaeMahngoh5oe";
+static __aligned(64) unsigned char ymm2[32 + 1] = "Tacuthahhien9Fi7aGhaa5toGh6vi7Ch";
 
-static __aligned unsigned char ymm3[32 + 1];
-static __aligned unsigned char ymm4[32 + 1];
+static __aligned(64) unsigned char ymm3[32 + 1];
+static __aligned(64) unsigned char ymm4[32 + 1];
 
 static int fpu_test(void)
 {
-- 
2.7.2



More information about the CRIU mailing list