* [Buildroot] [PATCH 1/1] package/libzenoh-pico: fix or1k build
@ 2024-01-10 21:55 Fabrice Fontaine
2024-02-05 13:24 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2024-01-10 21:55 UTC (permalink / raw)
To: buildroot; +Cc: Alex Michel, Fabrice Fontaine
Fix the following build failure with or1k raises since the addition of
the package in commit a96361901dcc7b962a0c43f163e97a2de65687f3:
/home/autobuild/autobuild/instance-1/output-1/build/libzenoh-pico-0.10.0-rc/src/link/endpoint.c: Assembler messages:
/home/autobuild/autobuild/instance-1/output-1/build/libzenoh-pico-0.10.0-rc/src/link/endpoint.c:358: Error: unrecognized instruction `nop'
Fixes:
- http://autobuild.buildroot.org/results/fd0b2c666a1dc1537162d15b27743abd270243ed
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
...001-Remove-nop-or-replace-with-macro.patch | 131 ++++++++++++++++++
package/libzenoh-pico/libzenoh-pico.mk | 6 +
2 files changed, 137 insertions(+)
create mode 100644 package/libzenoh-pico/0001-Remove-nop-or-replace-with-macro.patch
diff --git a/package/libzenoh-pico/0001-Remove-nop-or-replace-with-macro.patch b/package/libzenoh-pico/0001-Remove-nop-or-replace-with-macro.patch
new file mode 100644
index 0000000000..17692d60a3
--- /dev/null
+++ b/package/libzenoh-pico/0001-Remove-nop-or-replace-with-macro.patch
@@ -0,0 +1,131 @@
+From 7d79a14addcea972e801709413f5c9a5226e3ad3 Mon Sep 17 00:00:00 2001
+From: Jean-Roland Gosse <jean.roland.gosse@gmail.com>
+Date: Mon, 8 Jan 2024 17:40:03 +0100
+Subject: [PATCH] Remove nop or replace with macro (#314)
+
+* feat: remove nop instructions
+
+* feat: revert partly previous commit
+
+* feat: replace nops by configurable macro
+
+Upstream: https://github.com/eclipse-zenoh/zenoh-pico/commit/7d79a14addcea972e801709413f5c9a5226e3ad3
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ include/zenoh-pico/config.h | 7 +++++++
+ src/link/endpoint.c | 6 ------
+ src/system/arduino/esp32/network.cpp | 4 ++--
+ src/system/unix/system.c | 10 +++++-----
+ 4 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/include/zenoh-pico/config.h b/include/zenoh-pico/config.h
+index c1bb5ad83..084981a3e 100644
+--- a/include/zenoh-pico/config.h
++++ b/include/zenoh-pico/config.h
+@@ -309,4 +309,11 @@
+ #define Z_FRAG_MAX_SIZE 300000
+ #endif
+
++/**
++ * Default "nop" instruction
++ */
++#ifndef ZP_ASM_NOP
++#define ZP_ASM_NOP __asm__("nop")
++#endif
++
+ #endif /* INCLUDE_ZENOH_PICO_CONFIG_H */
+diff --git a/src/link/endpoint.c b/src/link/endpoint.c
+index ff596a07b..035e646a6 100644
+--- a/src/link/endpoint.c
++++ b/src/link/endpoint.c
+@@ -360,9 +360,7 @@ size_t _z_endpoint_config_strlen(const _z_str_intmap_t *s, const char *proto) {
+ } else
+ #endif
+ {
+- __asm__("nop");
+ }
+-
+ return len;
+ }
+
+@@ -398,9 +395,7 @@ char *_z_endpoint_config_to_str(const _z_str_intmap_t *s, const char *proto) {
+ } else
+ #endif
+ {
+- __asm__("nop");
+ }
+-
+ return res;
+ }
+
+diff --git a/src/system/arduino/esp32/network.cpp b/src/system/arduino/esp32/network.cpp
+index c088f1ce1..cac67f77b 100644
+--- a/src/system/arduino/esp32/network.cpp
++++ b/src/system/arduino/esp32/network.cpp
+@@ -558,7 +558,7 @@ int8_t _z_open_bt(_z_sys_net_socket_t *sock, const char *gname, uint8_t mode, ui
+ uint8_t connected = sock->_bts->connect(gname);
+ if (!connected) {
+ while (!sock->_bts->connected(tout)) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ }
+ } else {
+@@ -584,7 +584,7 @@ int8_t _z_listen_bt(_z_sys_net_socket_t *sock, const char *gname, uint8_t mode,
+ uint8_t connected = sock->_bts->connect(gname);
+ if (!connected) {
+ while (!sock->_bts->connected(tout)) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ }
+ } else {
+diff --git a/src/system/unix/system.c b/src/system/unix/system.c
+index 28223b83f..de5e4e505 100644
+--- a/src/system/unix/system.c
++++ b/src/system/unix/system.c
+@@ -32,7 +32,7 @@ uint8_t z_random_u8(void) {
+ uint8_t ret = 0;
+ #if defined(ZENOH_LINUX)
+ while (getrandom(&ret, sizeof(uint8_t), 0) <= 0) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ #elif defined(ZENOH_MACOS) || defined(ZENOH_BSD)
+ ret = z_random_u32();
+@@ -45,7 +45,7 @@ uint16_t z_random_u16(void) {
+ uint16_t ret = 0;
+ #if defined(ZENOH_LINUX)
+ while (getrandom(&ret, sizeof(uint16_t), 0) <= 0) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ #elif defined(ZENOH_MACOS) || defined(ZENOH_BSD)
+ ret = z_random_u32();
+@@ -58,7 +58,7 @@ uint32_t z_random_u32(void) {
+ uint32_t ret = 0;
+ #if defined(ZENOH_LINUX)
+ while (getrandom(&ret, sizeof(uint32_t), 0) <= 0) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ #elif defined(ZENOH_MACOS) || defined(ZENOH_BSD)
+ ret = arc4random();
+@@ -71,7 +71,7 @@ uint64_t z_random_u64(void) {
+ uint64_t ret = 0;
+ #if defined(ZENOH_LINUX)
+ while (getrandom(&ret, sizeof(uint64_t), 0) <= 0) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ #elif defined(ZENOH_MACOS) || defined(ZENOH_BSD)
+ ret |= z_random_u32();
+@@ -85,7 +85,7 @@ uint64_t z_random_u64(void) {
+ void z_random_fill(void *buf, size_t len) {
+ #if defined(ZENOH_LINUX)
+ while (getrandom(buf, len, 0) <= 0) {
+- __asm__("nop");
++ ZP_ASM_NOP;
+ }
+ #elif defined(ZENOH_MACOS) || defined(ZENOH_BSD)
+ arc4random_buf(buf, len);
diff --git a/package/libzenoh-pico/libzenoh-pico.mk b/package/libzenoh-pico/libzenoh-pico.mk
index 90dfda6c98..bb68f4a1f1 100644
--- a/package/libzenoh-pico/libzenoh-pico.mk
+++ b/package/libzenoh-pico/libzenoh-pico.mk
@@ -11,4 +11,10 @@ LIBZENOH_PICO_LICENSE_FILES = LICENSE
LIBZENOH_PICO_SUPPORTS_IN_SOURCE_BUILD = NO
LIBZENOH_PICO_INSTALL_STAGING = YES
+# __asm__("nop") is unsupported by or1k so define it to an empty value
+ifeq ($(BR2_or1k),y)
+LIBZENOH_PICO_CONF_OPTS += \
+ -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -DZP_ASM_NOP"
+endif
+
$(eval $(cmake-package))
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/libzenoh-pico: fix or1k build
2024-01-10 21:55 [Buildroot] [PATCH 1/1] package/libzenoh-pico: fix or1k build Fabrice Fontaine
@ 2024-02-05 13:24 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-02-05 13:24 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: Alex Michel, buildroot
On Wed, 10 Jan 2024 22:55:15 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> Fix the following build failure with or1k raises since the addition of
> the package in commit a96361901dcc7b962a0c43f163e97a2de65687f3:
>
> /home/autobuild/autobuild/instance-1/output-1/build/libzenoh-pico-0.10.0-rc/src/link/endpoint.c: Assembler messages:
> /home/autobuild/autobuild/instance-1/output-1/build/libzenoh-pico-0.10.0-rc/src/link/endpoint.c:358: Error: unrecognized instruction `nop'
>
> Fixes:
> - http://autobuild.buildroot.org/results/fd0b2c666a1dc1537162d15b27743abd270243ed
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> ...001-Remove-nop-or-replace-with-macro.patch | 131 ++++++++++++++++++
> package/libzenoh-pico/libzenoh-pico.mk | 6 +
> 2 files changed, 137 insertions(+)
> create mode 100644 package/libzenoh-pico/0001-Remove-nop-or-replace-with-macro.patch
Thanks a lot for this new patch. We discussed it with Arnout, and even
with this upstream patch the whole thing is still very messy. There
seems to be absolutely no reason for upstream to need this ZP_ASM_NOP
macro. So rather than piling bogus things on top of more bogus things,
I went ahead and applied a fix that just disables this package on or1k.
Ideally, we should explain to upstream that these asm("nop") are
useless.
Thanks for your work!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-05 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 21:55 [Buildroot] [PATCH 1/1] package/libzenoh-pico: fix or1k build Fabrice Fontaine
2024-02-05 13:24 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox