From 71471cb1d05f3877c8fb935fbf70a6bae789ac49 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 10 Mar 2016 08:09:41 -0700 Subject: [PATCH] Fix compile of test programs on archs that use arch_flags at runtime SuperH compile currently fails with: gettime.o: In function fio_gettime': /home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:163: undefined reference to arch_flags' gettime.o: In function utime_since_now': /home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:164: undefined reference to arch_flags' gettime.o: In function mtime_since_now': /home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:164: undefined reference to arch_flags' gettime.o: In function time_since_now': /home/thomas/projets/buildroot/output/build/fio-fio-2.7/gettime.c:164: undefined reference to arch_flags' mutex.o: In function fio_mutex_up': /home/thomas/projets/buildroot/output/build/fio-fio-2.7/mutex.c:189: undefined reference to arch_flags' collect2: error: ld returned 1 exit status Makefile:375: recipe for target 't/stest' failed make[2]: *** [t/stest] Error 1 make[2]: *** Waiting for unfinished jobs.... Fix that by ensuring we have a stub arch.o with the necessary arch flags for the standalone test programs. Signed-off-by: Jens Axboe --- Makefile | 6 +++--- t/arch.c | 5 +++++ t/dedupe.c | 1 + t/lfsr-test.c | 2 ++ t/stest.c | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 t/arch.c diff --git a/Makefile b/Makefile index 6b4c9db..a2502dc 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ endif -include $(OBJS:.o=.d) T_SMALLOC_OBJS = t/stest.o -T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o t/debug.o +T_SMALLOC_OBJS += gettime.o mutex.o smalloc.o t/log.o t/debug.o t/arch.o T_SMALLOC_PROGS = t/stest T_IEEE_OBJS = t/ieee754.o @@ -208,7 +208,7 @@ T_AXMAP_OBJS += lib/lfsr.o lib/axmap.o T_AXMAP_PROGS = t/axmap T_LFSR_TEST_OBJS = t/lfsr-test.o -T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o t/log.o t/debug.o +T_LFSR_TEST_OBJS += lib/lfsr.o gettime.o t/log.o t/debug.o t/arch.o T_LFSR_TEST_PROGS = t/lfsr-test T_GEN_RAND_OBJS = t/gen-rand.o @@ -223,7 +223,7 @@ endif T_DEDUPE_OBJS = t/dedupe.o T_DEDUPE_OBJS += lib/rbtree.o t/log.o mutex.o smalloc.o gettime.o crc/md5.o \ - lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o \ + lib/memalign.o lib/bloom.o t/debug.o crc/xxhash.o t/arch.o \ crc/murmur3.o crc/crc32c.o crc/crc32c-intel.o crc/fnv.o T_DEDUPE_PROGS = t/fio-dedupe diff --git a/t/arch.c b/t/arch.c new file mode 100644 index 0000000..befb7c7 --- /dev/null +++ b/t/arch.c @@ -0,0 +1,5 @@ +#include "../arch/arch.h" + +unsigned long arch_flags = 0; +int tsc_reliable; +int arch_random; diff --git a/t/dedupe.c b/t/dedupe.c index 3a66820..7856da1 100644 --- a/t/dedupe.c +++ b/t/dedupe.c @@ -537,6 +537,7 @@ int main(int argc, char *argv[]) uint64_t nextents = 0, nchunks = 0; int c, ret; + arch_init(argv); debug_init(); while ((c = getopt(argc, argv, "b:t:d:o:c:p:B:")) != -1) { diff --git a/t/lfsr-test.c b/t/lfsr-test.c index 4352b89..bad5097 100644 --- a/t/lfsr-test.c +++ b/t/lfsr-test.c @@ -38,6 +38,8 @@ int main(int argc, char *argv[]) void *v = NULL, *v_start; double total, mean; + arch_init(argv); + /* Read arguments */ switch (argc) { case 5: if (strncmp(argv[4], "verify", 7) == 0) diff --git a/t/stest.c b/t/stest.c index fb51989..0e0d8b0 100644 --- a/t/stest.c +++ b/t/stest.c @@ -4,6 +4,7 @@ #include "../smalloc.h" #include "../flist.h" +#include "../arch/arch.h" #include "debug.h" #define MAGIC1 0xa9b1c8d2 @@ -69,6 +70,7 @@ static int do_specific_alloc(unsigned long size) int main(int argc, char *argv[]) { + arch_init(argv); sinit(); debug_init(); -- 2.6.4