diff mbox series

[meta-oe] googlebenchmark: Fix build on riscv64

Message ID 20240611045707.489554-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] googlebenchmark: Fix build on riscv64 | expand

Commit Message

Khem Raj June 11, 2024, 4:57 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...ype-conversion-to-match-function-ret.patch | 32 +++++++++++++++++++
 .../googlebenchmark/googlebenchmark_1.8.4.bb  |  3 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/googlebenchmark/googlebenchmark/0002-cycleclock-Fix-type-conversion-to-match-function-ret.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/googlebenchmark/googlebenchmark/0002-cycleclock-Fix-type-conversion-to-match-function-ret.patch b/meta-oe/recipes-support/googlebenchmark/googlebenchmark/0002-cycleclock-Fix-type-conversion-to-match-function-ret.patch
new file mode 100644
index 0000000000..cc22a7e8a9
--- /dev/null
+++ b/meta-oe/recipes-support/googlebenchmark/googlebenchmark/0002-cycleclock-Fix-type-conversion-to-match-function-ret.patch
@@ -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;
diff --git a/meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.8.4.bb b/meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.8.4.bb
index 34732b42d9..706862f24a 100644
--- a/meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.8.4.bb
+++ b/meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.8.4.bb
@@ -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"