Skip to contentSkip to conversation

ckermit: Define return type for main

PATCH New Khem Raj 1 participant 4 messages May 29, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/4 ckermit: Define return type for main

Newer compilers e.g. clang19+ will treat implicit function prototypes as errors, therefore define main() with a valid return type

Fixes
ckwart.c:531:1: error: return type defaults to ‘int’ [-Wimplicit-int]

  531 | main(argc,argv) int argc; char **argv; {
      | ^~~~
---
 meta-oe/recipes-support/ckermit/ckermit_302.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-support/ckermit/ckermit_302.bb +1 -1
index 3525f7ba02..72a2e16e45 100644
@@ -45,7 +45,7 @@ do_compile () {
         -DNORESEND -DNOAUTODL -DNOSTREAMING -DNOHINTS -DNOCKXYZ -DNOLEARN \
         -DNOMKDIR -DNOPERMS -DNOCKTIMERS -DNOCKREGEX -DNOREALPATH \
         -DCK_SMALL -DNOLOGDIAL -DNORENAME -DNOWHATAMI \
-        -DNOARROWKEYS"
+        -DNOARROWKEYS -DMAINTYPE=int"
 }
 
 do_install () {
Signature · 1 line
2.45.1
author
#1 lore raw

PATCH 2/4 googlebenchmark: Fix type conversion errors found with clang

---
 ...ype-conversion-to-match-function-ret.patch | 34 +++++++++++++++++++
 .../googlebenchmark/googlebenchmark_1.8.4.bb  |  3 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/googlebenchmark/googlebenchmark/0001-cycleclock-Fix-type-conversion-to-match-function-ret.patch
meta-oe/recipes-support/googlebenchmark/googlebenchmark/0001-cycleclock-Fix-type-conversion-to-match-function-ret.patch new file +34 -0
new file mode 100644
index 0000000000..d514cf192b
@@ -0,0 +1,34 @@
+From db704bcc344529039d7fb28be380658625a9c08d Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 28 May 2024 19:34:43 -0700
+Subject: [PATCH] cycleclock: Fix type conversion to match function return type
+
+fixes build with clang19
+
+src/cycleclock.h:208:52: error: implicit conversion changes signedness: 'uint64_t' (aka 'unsigned long long') to 'int64_t' (aka 'long long') [-Werror,-Wsign-conversion]
+  208 |   return (static_cast<uint64_t>(cycles_hi1) << 32) | cycles_lo;
+      |   ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
+1 error generated.
+
+Upstream-Status: Submitted [https://github.com/google/benchmark/pull/1794]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/cycleclock.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cycleclock.h b/src/cycleclock.h
+index a2584376..f96801c5 100644
+--- a/src/cycleclock.h
++++ b/src/cycleclock.h
+@@ -205,7 +205,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
+       "sub %0, zero, %0\n"
+       "and %1, %1, %0\n"
+       : "=r"(cycles_hi0), "=r"(cycles_lo), "=r"(cycles_hi1));
+-  return (static_cast<uint64_t>(cycles_hi1) << 32) | cycles_lo;
++  return static_cast<int64_t>((static_cast<uint64_t>(cycles_hi1) << 32) | cycles_lo);
+ #else
+   uint64_t cycles;
+   asm volatile("rdtime %0" : "=r"(cycles));
+-- 
+2.45.1
+
meta-oe/recipes-support/googlebenchmark/googlebenchmark_1.8.4.bb +2 -1
index ffb57942ee..34732b42d9 100644
@@ -4,7 +4,8 @@ SECTION = "libs"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
-SRC_URI = "git://github.com/google/benchmark.git;protocol=https;branch=main"
+SRC_URI = "git://github.com/google/benchmark.git;protocol=https;branch=main \
+           file://0001-cycleclock-Fix-type-conversion-to-match-function-ret.patch"
 SRCREV = "a4cf155615c63e019ae549e31703bf367df5b471"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.45.1
author
#2 lore raw

PATCH 3/4 protobuf: Fix build on riscv32

In reply to Khem Raj

Link with libatomic since rv32 does not have 64bit atomics
Fixes
| riscv32-yoe-linux-musl-ld.lld: error: undefined reference: __atomic_load_8

---
 meta-oe/recipes-devtools/protobuf/protobuf_4.25.3.bb | 1 +
 1 file changed, 1 insertion(+)
meta-oe/recipes-devtools/protobuf/protobuf_4.25.3.bb +1 -0
index 3241345963..4f8515471f 100644
@@ -116,3 +116,4 @@ LDFLAGS:append:arm = " -latomic"
 LDFLAGS:append:mips = " -latomic"
 LDFLAGS:append:powerpc = " -latomic"
 LDFLAGS:append:mipsel = " -latomic"
+LDFLAGS:append:riscv32 = " -latomic"
Signature · 1 line
2.45.1
author
#3 lore raw

PATCH 4/4 mariadb: Fix build on riscv32

In reply to Khem Raj

Link explicitly with libatomic for 64bit atomics

---
 meta-oe/recipes-dbs/mysql/mariadb.inc | 1 +
 1 file changed, 1 insertion(+)
meta-oe/recipes-dbs/mysql/mariadb.inc +1 -0
index bbfad1e478..695965f7d2 100644
@@ -78,6 +78,7 @@ BUILD_CFLAGS += "-fuse-ld=bfd"
 BUILD_CXXFLAGS += "-fuse-ld=bfd"
 
 LDFLAGS:x86:toolchain-clang = "-latomic"
+LDFLAGS:riscv32:toolchain-clang = "-latomic"
 
 EXTRA_OECMAKE = "-DWITH_EMBEDDED_SERVER=ON \
                  -DWITH_JEMALLOC=no \
Signature · 1 line
2.45.1