diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-03-29 13:19:38 -0700 |
---|---|---|
committer | Andy Lutomirski <luto@amacapital.net> | 2014-03-29 13:19:38 -0700 |
commit | 10ffaf6773b02ef6e2eb9389d07082ba75839ab3 (patch) | |
tree | 4c7286e2a1d6407fd8c96dd0634235bba57aff93 | |
parent | 254ef237418d36b0239afb134d91d3048f7ea9d1 (diff) | |
download | misc-tests-10ffaf6773b02ef6e2eb9389d07082ba75839ab3.tar.gz |
Fix some warnings and build 32-bit and 64-bit versions.
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | evil-clock-test.cc | 2 | ||||
-rw-r--r-- | test_vsyscall.cc | 4 |
3 files changed, 15 insertions, 9 deletions
@@ -1,17 +1,23 @@ .PHONY: all clean -all: timing_test evil-clock-test test_vsyscall dump-vdso dump-vvar dump-vsyscall context_switch_latency +all: timing_test_64 timing_test_32 evil-clock-test test_vsyscall_64 test_vsyscall_32 dump-vdso dump-vvar dump-vsyscall context_switch_latency clean: - rm -f timing_test evil-clock-test test_vsyscall dump-vdso dump-vvar dump-vsyscall context_switch_latency + rm -f timing_test_64 timing_test_32 evil-clock-test test_vsyscall_64 test_vsyscall_32 dump-vdso dump-vvar dump-vsyscall context_switch_latency -timing_test: timing_test.cc - g++ -o $@ -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -ldl +timing_test_64: timing_test.cc + g++ -m64 -o $@ -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -ldl + +timing_test_32: timing_test.cc + g++ -m32 -o $@ -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -ldl evil-clock-test: evil-clock-test.cc g++ -o $@ -pthread -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -test_vsyscall: test_vsyscall.cc - g++ -o $@ -std=gnu++0x -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -ldl +test_vsyscall_64: test_vsyscall.cc + g++ -m64 -o $@ -std=gnu++0x -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -ldl + +test_vsyscall_32: test_vsyscall.cc + g++ -m32 -o $@ -std=gnu++0x -O2 -Wall $(EXTRA_CFLAGS) -g $^ -lrt -ldl dump-vdso: dump-vdso.c gcc -o $@ -O2 $(EXTRA_CFLAGS) $^ -ldl diff --git a/evil-clock-test.cc b/evil-clock-test.cc index 68f7503..164a0b1 100644 --- a/evil-clock-test.cc +++ b/evil-clock-test.cc @@ -273,7 +273,6 @@ public: int thread2, Time *times2) { Time t1max = 0, t2max = 0; - int idx1; bool t1fresh = false; for(int i = 0; i < len; i++) { @@ -303,7 +302,6 @@ public: worst_error = INT64_MAX; } else { t1max = times1[i]; - idx1 = i; t1fresh = true; } } diff --git a/test_vsyscall.cc b/test_vsyscall.cc index 14c49bf..e131c37 100644 --- a/test_vsyscall.cc +++ b/test_vsyscall.cc @@ -101,8 +101,8 @@ static void segv(int sig, siginfo_t *info, void *ctx_void) { psiginfo(info, "Caught SIGSEGV"); - ucontext_t *ctx = (ucontext_t*)ctx_void; #ifdef REG_RIP + ucontext_t *ctx = (ucontext_t*)ctx_void; printf("RIP = %lx\n", (unsigned long)ctx->uc_mcontext.gregs[REG_RIP]); #endif @@ -361,12 +361,14 @@ struct __attribute__((packed)) farptr { uint16_t sel; }; +#if __x86_64__ static bool to_farptr(farptr *out, uint16_t sel, void *offset) { out->sel = sel; out->offset = (uint32_t)(unsigned long)offset; return out->offset == (unsigned long)offset; } +#endif int intcc32(int argc, char **argv) { |