googlebenchmark: Fix build on riscv64

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2024-06-10 21:55:41 -07:00
parent 8b01302835
commit 185e779bad
2 changed files with 34 additions and 1 deletions
@@ -0,0 +1,32 @@
From 54bca09aca6ccec41f852cb1f834463bc51290d0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 10 Jun 2024 21:45:22 -0700
Subject: [PATCH] cycleclock: Fix type conversion to match function return type
on riscv64
Fixes builds with clang
src/cycleclock.h:213:10: error: implicit conversion changes signedness: 'uint64_t' (aka 'unsigned long') to 'int64_t' (aka 'long') [-Werror,-Wsign-conversion]
213 | return cycles;
| ~~~~~~ ^~~~~~
1 error generated.
Upstream-Status: Submitted [https://github.com/google/benchmark/pull/1802]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/cycleclock.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cycleclock.h b/src/cycleclock.h
index c657414..bd62f5d 100644
--- a/src/cycleclock.h
+++ b/src/cycleclock.h
@@ -210,7 +210,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
#else
uint64_t cycles;
asm volatile("rdtime %0" : "=r"(cycles));
- return cycles;
+ return static_cast<int64_t>(cycles);
#endif
#elif defined(__e2k__) || defined(__elbrus__)
struct timeval tv;
@@ -5,7 +5,8 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
SRC_URI = "git://github.com/google/benchmark.git;protocol=https;branch=main \
file://0001-cycleclock-Fix-type-conversion-to-match-function-ret.patch"
file://0001-cycleclock-Fix-type-conversion-to-match-function-ret.patch \
file://0002-cycleclock-Fix-type-conversion-to-match-function-ret.patch"
SRCREV = "a4cf155615c63e019ae549e31703bf367df5b471"
S = "${WORKDIR}/git"