From 0da639dbc3de0ac8c6a49a21fc6a6db43269f806 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 13 Sep 2017 17:13:58 -0700 Subject: [PATCH] Compile Dhrystone with multiple GCC runs This doesn't actually make a difference because we had some pragmas in there to avoid badness, but this sets a better example. --- test/benchmarks/dhrystone/check | 6 +++++- test/benchmarks/dhrystone/dhrystone.h | 2 +- test/benchmarks/dhrystone/dhrystone_main.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/benchmarks/dhrystone/check b/test/benchmarks/dhrystone/check index 79f5456e..0c9d2ae8 100755 --- a/test/benchmarks/dhrystone/check +++ b/test/benchmarks/dhrystone/check @@ -28,7 +28,11 @@ echo "ERROR: $march-$mabi failed to run" >$out tempdir=$(mktemp -d) trap "rm -rf $tempdir" EXIT -$cc ${c[@]} -march=$march -mabi=$mabi -O3 -o $tempdir/dhrystone -static -Wno-all +for f in ${c[@]} +do + $cc -c $f -march=$march -mabi=$mabi -O3 -fno-common -fno-inline -o $tempdir/$(basename $f).o -static -Wno-all +done +$cc -march=$march -mabi=$mabi $tempdir/*.o -o $tempdir/dhrystone $objdump -d $tempdir/dhrystone > ~/dump begin_pc=$($objdump -d $tempdir/dhrystone | grep 'Begin_Time' | grep -e 'sd' -e 'sw' | cut -d: -f1 | xargs echo) diff --git a/test/benchmarks/dhrystone/dhrystone.h b/test/benchmarks/dhrystone/dhrystone.h index c2ef663a..e36a93aa 100644 --- a/test/benchmarks/dhrystone/dhrystone.h +++ b/test/benchmarks/dhrystone/dhrystone.h @@ -391,7 +391,7 @@ extern clock_t clock(); *** You must define HZ!!! *** #endif /* HZ */ #ifndef PASS2 -struct tms time_info; +extern struct tms time_info; #endif /*extern int times ();*/ /* see library function "times" */ diff --git a/test/benchmarks/dhrystone/dhrystone_main.c b/test/benchmarks/dhrystone/dhrystone_main.c index 9ba0c0e4..c07fd58b 100644 --- a/test/benchmarks/dhrystone/dhrystone_main.c +++ b/test/benchmarks/dhrystone/dhrystone_main.c @@ -7,6 +7,8 @@ // This is the classic Dhrystone synthetic integer benchmark. // +struct tms time_info; + #define read_csr(reg) ({ unsigned long __tmp; \ asm volatile ("csrr %0, " #reg : "=r"(__tmp)); \ __tmp; })