From: Jens Axboe Date: Thu, 10 Mar 2016 15:09:41 +0000 (-0700) Subject: Fix compile of test programs on archs that use arch_flags at runtime X-Git-Tag: fio-2.8~6 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=71471cb1d05f3877c8fb935fbf70a6bae789ac49;ds=sidebyside 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 --- diff --git a/Makefile b/Makefile index 6b4c9dbf..a2502dcd 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 00000000..befb7c7f --- /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 3a66820f..7856da1a 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 4352b89f..bad50972 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 fb519895..0e0d8b0b 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();