Port 176.gcc benchmark and design build system
This benchmark does not work right now as currently we don't have
support for getrlimit
Change-Id: I69dec0260691064ef515c0faad8a20e481794df8
diff --git a/.gitignore b/.gitignore
index cdfea44..1fbd528 100644
--- a/.gitignore
+++ b/.gitignore
Binary files differ
diff --git a/176.gcc/BUILD.gn b/176.gcc/BUILD.gn
new file mode 100644
index 0000000..09500a5
--- /dev/null
+++ b/176.gcc/BUILD.gn
@@ -0,0 +1,101 @@
+# Copyright 2016 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+executable("176.gcc") {
+ sources = [
+ "src/bc-emit.c",
+ "src/bc-optab.c",
+ "src/c-aux-info.c",
+ "src/c-common.c",
+ "src/c-convert.c",
+ "src/c-decl.c",
+ "src/c-gperf.h",
+ "src/c-iterate.c",
+ "src/c-lang.c",
+ "src/c-lex.c",
+ "src/c-parse.c",
+ "src/c-pragma.c",
+ "src/c-typeck.c",
+ "src/caller-save.c",
+ "src/calls.c",
+ "src/combine.c",
+ "src/convert.c",
+ "src/cse.c",
+ "src/dbxout.c",
+ "src/dwarfout.c",
+ "src/emit-rtl.c",
+ "src/explow.c",
+ "src/expmed.c",
+ "src/expr.c",
+ "src/final.c",
+ "src/flow.c",
+ "src/fold-const.c",
+ "src/function.c",
+ "src/getpwd.c",
+ "src/global.c",
+ "src/insn-attrtab.c",
+ "src/insn-emit.c",
+ "src/insn-extract.c",
+ "src/insn-opinit.c",
+ "src/insn-output.c",
+ "src/insn-peep.c",
+ "src/insn-recog.c",
+ "src/integrate.c",
+ "src/jump.c",
+ "src/local-alloc.c",
+ "src/loop.c",
+ "src/m88k.c",
+ "src/obstack.c",
+ "src/optabs.c",
+ "src/print-rtl.c",
+ "src/print-tree.c",
+ "src/real.c",
+ "src/recog.c",
+ "src/reg-stack.c",
+ "src/regclass.c",
+ "src/reload.c",
+ "src/reload1.c",
+ "src/reorg.c",
+ "src/rtl.c",
+ "src/rtlanal.c",
+ "src/sched.c",
+ "src/sdbout.c",
+ "src/stmt.c",
+ "src/stor-layout.c",
+ "src/stupid.c",
+ "src/toplev.c",
+ "src/tree.c",
+ "src/unroll.c",
+ "src/varasm.c",
+ "src/version.c",
+ "src/xcoffout.c",
+ ]
+ defines = [ "HOST_WORDS_LITTLE_ENDIAN" ]
+ cflags_c = [
+ "-Wno-char-subscripts",
+ "-Wno-enum-conversion",
+ "-Wno-format",
+ "-Wno-format-extra-args",
+ "-Wno-format-security",
+ "-Wno-implicit-function-declaration",
+ "-Wno-implicit-int",
+ "-Wno-int-to-pointer-cast",
+ "-Wno-missing-braces",
+ "-Wno-missing-field-initializers",
+ "-Wno-non-literal-null-conversion",
+ "-Wno-parentheses",
+ "-Wno-return-type",
+ "-Wno-shift-negative-value",
+ "-Wno-sign-compare",
+ "-Wno-sometimes-uninitialized",
+ "-Wno-static-in-inline",
+ "-Wno-switch",
+ "-Wno-tautological-constant-out-of-range-compare",
+ "-Wno-unused-function",
+ "-Wno-unused-label",
+ "-Wno-unused-value",
+ "-Wno-unused-variable",
+ "-Wno-varargs",
+ ]
+}
diff --git a/176.gcc/fuchsia.patch b/176.gcc/fuchsia.patch
new file mode 100644
index 0000000..f35f17e
--- /dev/null
+++ b/176.gcc/fuchsia.patch
@@ -0,0 +1,26 @@
+diff -Nau0rbB src/c-gperf.h src.patched/c-gperf.h
+--- src/c-gperf.h 1998-12-01 09:51:50.000000000 -0800
++++ src.patched/c-gperf.h 2016-09-01 15:15:32.368341256 -0700
+@@ -165,3 +165 @@
+-#ifdef __GNUC__
+-inline
+-#endif
++static inline
+diff -Nau0rbB src/sdbout.c src.patched/sdbout.c
+--- src/sdbout.c 1998-12-01 09:51:50.000000000 -0800
++++ src.patched/sdbout.c 2016-09-01 15:15:32.372341230 -0700
+@@ -1318 +1318 @@
+- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms), 0));
++ PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
+@@ -1341 +1341 @@
+- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms), 0));
++ PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
+@@ -1379 +1379 @@
+- PUT_SDB_TYPE (plain_type (TREE_TYPE (parms), 0));
++ PUT_SDB_TYPE (plain_type (TREE_TYPE (parms)));
+diff -Nau0rbB src/toplev.c src.patched/toplev.c
+--- src/toplev.c 2005-06-23 15:48:32.000000000 -0700
++++ src.patched/toplev.c 2016-09-01 15:15:32.364341284 -0700
+@@ -3923 +3923 @@
+-#if !defined(OS2) && !defined(VMS) && !defined(_WIN32)
++#if !defined(OS2) && !defined(VMS) && !defined(_WIN32) && !defined(__Fuchsia__)
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..4d4d9db
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,9 @@
+# Copyright 2016 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+group("speccpu2000") {
+ deps = [
+ "176.gcc",
+ ]
+}
diff --git a/README.md b/README.md
index d749e88..930e52d 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,10 @@
Harness for SPEC CPU2000 benchmarks. To compile and build it, sources from SPEC
CPU2000 tarball needs to be unpacked in this folder.
+
+To prepare the build, download the tar for SPEC\_CPU2000v1.3.tar and then run
+
+```
+./patch.sh path/to/SPEC\_CPU2000v1.3
+```
+This command will extract the tar, copy sources and patch them for fuchsia.
diff --git a/patch.sh b/patch.sh
new file mode 100755
index 0000000..a18a70d
--- /dev/null
+++ b/patch.sh
@@ -0,0 +1,73 @@
+#!/usr/bin/env bash
+# Copyright 2016 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+readonly SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+readonly CINT_BLIST=(
+ "164.gzip"
+ "175.vpr"
+ "176.gcc"
+ "181.mcf"
+ "186.crafty"
+ "197.parser"
+ "252.eon"
+ "253.perlbmk"
+ "254.gap"
+ "255.vortex"
+ "256.bzip2"
+ "300.twolf"
+)
+readonly CFP_BLIST=(
+ "168.wupwise"
+ "171.swim"
+ "172.mgrid"
+ "173.applu"
+ "177.mesa"
+ "178.galgel"
+ "179.art"
+ "183.equake"
+ "187.facerec"
+ "188.ammp"
+ "189.lucas"
+ "191.fma3d"
+ "200.sixtrack"
+ "301.apsi"
+)
+
+function copynpatch() {
+ local benchmark_dir=$1
+ shift
+ for i in $@; do
+ local benchmark="$benchmark_dir/$i"
+ if [[ -d "$benchmark" ]]; then
+ # check if we support that benchmark
+ if [[ -e "$SCRIPT_DIR/$i" ]]; then
+ echo "Copying src for $i....."
+ cp -r -- "$benchmark/src" "$SCRIPT_DIR/$i/"
+ # Some src have only read permission, so if script is
+ # executed again source are not replaced
+ chmod -R u+w -- "$SCRIPT_DIR/$i/src"
+
+ echo "Copying data for $i....."
+ cp -r -- "$benchmark/data" "$SCRIPT_DIR/$i/"
+ chmod -R u+w -- "$SCRIPT_DIR/$i/data"
+
+ # check if we have a diff
+ if [[ -e "$SCRIPT_DIR/$i/fuchsia.patch" ]] ; then
+ echo "Patching $i.........."
+ patch -d "$SCRIPT_DIR/$i" --verbose -p0 < "$SCRIPT_DIR/$i/fuchsia.patch"
+ fi
+ echo
+ fi
+ fi
+ done
+}
+
+if [[ $# -ne 1 ]]; then
+ echo "usage: $0 <path/to/SPEC_CPU2000v1.3>"
+ exit 1
+fi
+
+copynpatch "$1/benchspec/CINT2000" ${CINT_BLIST[*]}
+copynpatch "$1/benchspec/CFP2000" ${CFP_BLIST[*]}