From f795779c0a4080ccf497a0266e33f1842248efe8 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 15 Nov 2019 12:34:26 -0800 Subject: [PATCH] boost: Fix fiber compilation for mips The issue was that the pause instruction was emitted through an asm directive which was not correct for some mips platforms. Simplified boost-fiber-exclude as a result. Removed uClibc-ng math patch. It was not correct as it broke float and long double support (std variants use function overloads). A different solution was applied upstream. As it's quite annoying to backport, just wait until a new release comes with that change. ARC as a platform is barely supported anyways. Swapped asio patch for the upstream submission, which is unfortunately, in limbo. Refreshed remaining patch. Signed-off-by: Rosen Penev --- libs/boost/Makefile | 4 +-- libs/boost/patches/001-uclibc-asio.patch | 29 +++++++++++++++++-- libs/boost/patches/002-utime-filesystem.patch | 4 +-- libs/boost/patches/003-mips-pause.patch | 28 ++++++++++++++++++ libs/boost/patches/101-uclibc-ng-math.patch | 21 -------------- 5 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 libs/boost/patches/003-mips-pause.patch delete mode 100644 libs/boost/patches/101-uclibc-ng-math.patch diff --git a/libs/boost/Makefile b/libs/boost/Makefile index 90518c17a..4eac36ae4 100644 --- a/libs/boost/Makefile +++ b/libs/boost/Makefile @@ -13,7 +13,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=boost PKG_VERSION:=1.71.0 PKG_SOURCE_VERSION:=1_71_0 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/$(PKG_NAME)/$(PKG_NAME)/$(PKG_VERSION) https://dl.bintray.com/boostorg/release/$(PKG_VERSION)/source/ @@ -130,7 +130,7 @@ define Package/boost/config config boost-fiber-exclude bool - default y if (TARGET_ar7 || TARGET_brcm47xx_generic || TARGET_brcm47xx_legacy || TARGET_lantiq_ase || TARGET_rb532 || mips32 || mips64 || boost-coroutine-exclude) + default y if boost-coroutine-exclude default n menu "Select Boost Options" diff --git a/libs/boost/patches/001-uclibc-asio.patch b/libs/boost/patches/001-uclibc-asio.patch index b7732d0e7..07efd1305 100644 --- a/libs/boost/patches/001-uclibc-asio.patch +++ b/libs/boost/patches/001-uclibc-asio.patch @@ -1,3 +1,28 @@ +From 95d82acc57bb7d8bae431f7a6ce0707aac3ef33f Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Thu, 5 Sep 2019 19:41:13 -0700 +Subject: [PATCH] Use eventfd() function with uClibc + +The Boost eventfd code either directly makes the eventfd system call +using __NR_eventfd (when __GLIBC_MINOR is less than 8), or otherwise +uses the eventfd() function provided by the C library. + +However, since uClibc pretends to be glibc 2.2, the Boost eventfd code +directly uses the system call. While it works fine on most +architectures, it doesn't on ARC since __NR_eventfd is not defined on +this architecture. However, eventfd() is properly implemented. + +So, this patch adjusts the logic used by Boost to consider uClibc as a +C library providing the eventfd() function. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Rosen Penev +--- + a/boost/asio/detail/impl/eventfd_select_interrupter.ipp | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/boost/asio/detail/impl/eventfd_select_interrupter.ipp +index 38d4b2a61..e16cc8b00 100644 --- a/boost/asio/detail/impl/eventfd_select_interrupter.ipp +++ b/boost/asio/detail/impl/eventfd_select_interrupter.ipp @@ -23,11 +23,11 @@ @@ -15,7 +40,7 @@ #include #include #include -@@ -46,14 +46,14 @@ eventfd_select_interrupter::eventfd_sele +@@ -46,14 +46,14 @@ eventfd_select_interrupter::eventfd_select_interrupter() void eventfd_select_interrupter::open_descriptors() { @@ -32,7 +57,7 @@ # if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) write_descriptor_ = read_descriptor_ = ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); -@@ -70,7 +70,7 @@ void eventfd_select_interrupter::open_de +@@ -70,7 +70,7 @@ void eventfd_select_interrupter::open_descriptors() ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); } } diff --git a/libs/boost/patches/002-utime-filesystem.patch b/libs/boost/patches/002-utime-filesystem.patch index 2a778af3a..9b5c246ae 100644 --- a/libs/boost/patches/002-utime-filesystem.patch +++ b/libs/boost/patches/002-utime-filesystem.patch @@ -37,7 +37,7 @@ index 9bba1cf7a..038109d35 100644 # include "limits.h" # else // BOOST_WINDOW_API -@@ -1451,6 +1453,22 @@ namespace detail +@@ -1459,6 +1461,22 @@ namespace detail system::error_code* ec) { # ifdef BOOST_POSIX_API @@ -60,7 +60,7 @@ index 9bba1cf7a..038109d35 100644 struct stat path_stat; if (error(::stat(p.c_str(), &path_stat)!= 0, -@@ -1462,6 +1480,8 @@ namespace detail +@@ -1470,6 +1488,8 @@ namespace detail error(::utime(p.c_str(), &buf)!= 0 ? BOOST_ERRNO : 0, p, ec, "boost::filesystem::last_write_time"); diff --git a/libs/boost/patches/003-mips-pause.patch b/libs/boost/patches/003-mips-pause.patch new file mode 100644 index 000000000..10a0ae900 --- /dev/null +++ b/libs/boost/patches/003-mips-pause.patch @@ -0,0 +1,28 @@ +From 5f7cda29add367c5381775a314ec9f90e311457a Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Fri, 15 Nov 2019 12:43:50 -0800 +Subject: [PATCH] cpu_relax: Fix MIPS check + +BOOST_ARCH_MIPS as a macro is totally broken. It always gets defined to either 32 +or 64 with a bunch of zeroes depending on the architecture. + +Use GCC's internal define to check the architecture properly. + +Signed-off-by: Rosen Penev +--- + boost/fiber/detail/cpu_relax.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/boost/fiber/detail/cpu_relax.hpp b/boost/fiber/detail/cpu_relax.hpp +index 72564394..f40545c2 100644 +--- a/boost/fiber/detail/cpu_relax.hpp ++++ b/boost/fiber/detail/cpu_relax.hpp +@@ -47,7 +47,7 @@ namespace detail { + # else + # define cpu_relax() asm volatile ("nop" ::: "memory"); + # endif +-#elif BOOST_ARCH_MIPS ++#elif BOOST_ARCH_MIPS && (__mips_isa_rev > 1) + # define cpu_relax() asm volatile ("pause" ::: "memory"); + #elif BOOST_ARCH_PPC + // http://code.metager.de/source/xref/gnu/glibc/sysdeps/powerpc/sys/platform/ppc.h diff --git a/libs/boost/patches/101-uclibc-ng-math.patch b/libs/boost/patches/101-uclibc-ng-math.patch deleted file mode 100644 index 0d1668602..000000000 --- a/libs/boost/patches/101-uclibc-ng-math.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/boost/math/tools/roots.hpp -+++ b/boost/math/tools/roots.hpp -@@ -665,8 +665,8 @@ namespace detail - inline T discriminant(T const & a, T const & b, T const & c) - { - T w = 4*a*c; -- T e = std::fma(-c, 4*a, w); -- T f = std::fma(b, b, -w); -+ T e = fma(-c, 4*a, w); -+ T f = fma(b, b, -w); - return f + e; - } - } -@@ -674,7 +674,6 @@ namespace detail - template - auto quadratic_roots(T const& a, T const& b, T const& c) - { -- using std::copysign; - using std::sqrt; - if constexpr (std::is_integral::value) - {