aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-09-13 17:13:58 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-09-13 17:13:58 -0700
commit0da639dbc3de0ac8c6a49a21fc6a6db43269f806 (patch)
tree99126e58d2a8af2c5274ca339634a54323fe1c70
parent36c9832aa7f9b937627584222dd5778947f0e81c (diff)
downloadriscv-gnu-toolchain-0da639dbc3de0ac8c6a49a21fc6a6db43269f806.zip
riscv-gnu-toolchain-0da639dbc3de0ac8c6a49a21fc6a6db43269f806.tar.gz
riscv-gnu-toolchain-0da639dbc3de0ac8c6a49a21fc6a6db43269f806.tar.bz2
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.
-rwxr-xr-xtest/benchmarks/dhrystone/check6
-rw-r--r--test/benchmarks/dhrystone/dhrystone.h2
-rw-r--r--test/benchmarks/dhrystone/dhrystone_main.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/test/benchmarks/dhrystone/check b/test/benchmarks/dhrystone/check
index 79f5456..0c9d2ae 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 c2ef663..e36a93a 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 9ba0c0e..c07fd58 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; })