diff mbox series

[meta-oe,01/10] poco: Do not use std::atomic<bool>

Message ID 20230127055440.2108933-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,01/10] poco: Do not use std::atomic<bool> | expand

Commit Message

Khem Raj Jan. 27, 2023, 5:54 a.m. UTC
They are not implemented for all arches e.g. RISCV on gcc 13 yet
Fixes
riscv64-yoe-linux/gcc/riscv64-yoe-linux/13.0.1/ld: lib/libPocoFoundation.so.94: unde
fined reference to `__atomic_exchange_1'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...tomic-int-instead-of-std-atomic-bool.patch | 60 +++++++++++++++++++
 meta-oe/recipes-support/poco/poco_1.12.4.bb   |  1 +
 2 files changed, 61 insertions(+)
 create mode 100644 meta-oe/recipes-support/poco/poco/0001-Use-std-atomic-int-instead-of-std-atomic-bool.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/poco/poco/0001-Use-std-atomic-int-instead-of-std-atomic-bool.patch b/meta-oe/recipes-support/poco/poco/0001-Use-std-atomic-int-instead-of-std-atomic-bool.patch
new file mode 100644
index 0000000000..b06135222a
--- /dev/null
+++ b/meta-oe/recipes-support/poco/poco/0001-Use-std-atomic-int-instead-of-std-atomic-bool.patch
@@ -0,0 +1,60 @@ 
+From 4cbb225811205b51b65371d0d8abc2d2af8233b6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 26 Jan 2023 14:56:36 -0800
+Subject: [PATCH] Use std::atomic<int> instead of std::atomic<bool>
+
+GCC on RISCV does not yet support inline subword atomics [1]
+Therefore avoid them until fixed
+
+Upstream-Status: Pending
+
+[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104338
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Foundation/include/Poco/AsyncChannel.h | 2 +-
+ Foundation/src/AsyncChannel.cpp        | 5 ++---
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/Foundation/include/Poco/AsyncChannel.h b/Foundation/include/Poco/AsyncChannel.h
+index 190bae7dd..d73ea6c72 100644
+--- a/Foundation/include/Poco/AsyncChannel.h
++++ b/Foundation/include/Poco/AsyncChannel.h
+@@ -111,7 +111,7 @@ private:
+ 	NotificationQueue _queue;
+ 	std::size_t _queueSize = 0;
+ 	std::size_t _dropCount = 0;
+-	std::atomic<bool> _closed;
++	std::atomic<int> _closed;
+ };
+ 
+ 
+diff --git a/Foundation/src/AsyncChannel.cpp b/Foundation/src/AsyncChannel.cpp
+index 37cdec477..e829b180c 100644
+--- a/Foundation/src/AsyncChannel.cpp
++++ b/Foundation/src/AsyncChannel.cpp
+@@ -48,11 +48,10 @@ private:
+ 	Message _msg;
+ };
+ 
+-
+ AsyncChannel::AsyncChannel(Channel::Ptr pChannel, Thread::Priority prio):
+ 	_pChannel(pChannel),
+ 	_thread("AsyncChannel"),
+-	_closed(false)
++	_closed(0)
+ {
+ 	_thread.setPriority(prio);
+ }
+@@ -95,7 +94,7 @@ void AsyncChannel::open()
+ 
+ void AsyncChannel::close()
+ {
+-	if (!_closed.exchange(true))
++	if (!_closed.exchange(1))
+ 	{
+ 		if (_thread.isRunning())
+ 		{
+-- 
+2.39.1
+
diff --git a/meta-oe/recipes-support/poco/poco_1.12.4.bb b/meta-oe/recipes-support/poco/poco_1.12.4.bb
index f66a272524..51bd5611fb 100644
--- a/meta-oe/recipes-support/poco/poco_1.12.4.bb
+++ b/meta-oe/recipes-support/poco/poco_1.12.4.bb
@@ -9,6 +9,7 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=4267f48fc738f50380cbeeb76f95cebc"
 DEPENDS = "libpcre2 zlib"
 
 SRC_URI = "git://github.com/pocoproject/poco.git;branch=master;protocol=https \
+           file://0001-Use-std-atomic-int-instead-of-std-atomic-bool.patch \
            file://run-ptest \
            "
 SRCREV = "1211613642269b7d53bea58b02de7fcd25ece3b9"