[csmith/f18] fix build on all arches by adding fallback implementation for getting initial seed
Dan Horák
sharkcz at fedoraproject.org
Thu Dec 6 10:34:53 UTC 2012
commit 5665003a5f1648f01c2a2e49e5258e4c92955e27
Author: Dan Horák <dan at danny.cz>
Date: Thu Dec 6 11:34:14 2012 +0100
fix build on all arches by adding fallback implementation for getting initial seed
csmith-2.1.0-secondary.patch | 38 ++++++++++++++++++++++++++++++++++++++
csmith.spec | 7 ++++++-
2 files changed, 44 insertions(+), 1 deletions(-)
---
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 <stdlib.h>
+ #include <sys/types.h>
+-#include <sys/timeb.h>
++#include <sys/time.h>
+
+ #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 <dan[at]danny.cz> - 2.1.0-7
+- fix build on all arches by adding fallback implementation for getting initial seed
+
* Mon Nov 19 2012 Shakthi Kannan <shakthimaan [AT] fedoraproject dot org> 2.1.0-6
- Removed BuildRoot tag
- Add multiple license comment
More information about the scm-commits
mailing list