From bfd166dc57e4d7387a53295ccc508b2f33a7159e Mon Sep 17 00:00:00 2001 From: Dan Horák Date: Dec 06 2012 10:34:14 +0000 Subject: fix build on all arches by adding fallback implementation for getting initial seed --- diff --git a/csmith-2.1.0-secondary.patch b/csmith-2.1.0-secondary.patch new file mode 100644 index 0000000..210dd15 --- /dev/null +++ b/csmith-2.1.0-secondary.patch @@ -0,0 +1,38 @@ +diff -up csmith-2.1.0/src/platform.cpp.secondary csmith-2.1.0/src/platform.cpp +--- csmith-2.1.0/src/platform.cpp.secondary 2012-12-06 11:06:11.000000000 +0100 ++++ csmith-2.1.0/src/platform.cpp 2012-12-06 11:16:41.000000000 +0100 +@@ -39,8 +39,9 @@ + // --------------------------------------- + // Platform-Specific code to get a unique seed value (usually from the tick counter, etc) + // ++#include + #include +-#include ++#include + + #include "platform.h" + +@@ -71,6 +72,7 @@ static unsigned __int64 read_time(void) + return (h << 32) + l ; + } + #else ++#if defined(__x86_64__) || defined(__i386__) + static long long read_time(void) { + long long l; + asm volatile( "rdtsc\n\t" +@@ -78,6 +80,15 @@ static long long read_time(void) { + ); + return l; + } ++#else ++/* fallback using gettimeofday() */ ++static unsigned long long read_time(void) { ++ struct timeval tv; ++ ++ gettimeofday(&tv, NULL); ++ return tv.tv_sec * 1000000 + tv.tv_usec; ++} ++#endif + #endif + #endif + diff --git a/csmith.spec b/csmith.spec index f5b7ce1..a63cbd5 100644 --- a/csmith.spec +++ b/csmith.spec @@ -1,6 +1,6 @@ Name: csmith Version: 2.1.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Tool to generate random C programs for compiler testing Group: Development/Tools @@ -10,6 +10,7 @@ URL: http://embed.cs.utah.edu/csmith/ Source0: http://embed.cs.utah.edu/csmith/%{name}-%{version}.tar.gz Patch0: csmith-2.1.0-fix-powerpc64-build.patch Patch1: csmith-2.1.0-remove-custom-headers.patch +Patch2: csmith-2.1.0-secondary.patch BuildRequires: m4 @@ -33,6 +34,7 @@ and libraries for use with the Csmith package. %setup -q %patch0 -p1 -b .ppc64 %patch1 -p1 -b .fix +%patch2 -p1 -b .secondary %build %configure @@ -68,6 +70,9 @@ rm -rf %{buildroot} %{_libdir}/libcsmith.so %changelog +* Thu Dec 06 2012 Dan Horák - 2.1.0-7 +- fix build on all arches by adding fallback implementation for getting initial seed + * Mon Nov 19 2012 Shakthi Kannan 2.1.0-6 - Removed BuildRoot tag - Add multiple license comment