[CRIU] [RFC PATCH 06/21] zdtm: reuse criu's compiler.h
Ivan Shapovalov
intelfx at intelfx.name
Fri Feb 19 06:50:29 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/live/static/Makefile | 3 ++-
test/zdtm/live/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 5e0d420..d388bda 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -29,7 +29,7 @@ ifeq ($(shell echo $(ARCH) | sed -e 's/ppc64.*/ppc64/'),ppc64)
SRCARCH := ppc64
endif
-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 a8f9e02..5f5760c 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
@@ -96,15 +98,6 @@ extern int parse_opt_string(char *param, void *arg);
#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/live/static/Makefile b/test/zdtm/live/static/Makefile
index 06e5985..4bef15b 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/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/live/static/fpu01.c b/test/zdtm/live/static/fpu01.c
index c8e6ca1..704b768 100644
--- a/test/zdtm/live/static/fpu01.c
+++ b/test/zdtm/live/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.1
More information about the CRIU
mailing list