Browse Source

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 <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 5 years ago
parent
commit
f795779c0a
5 changed files with 59 additions and 27 deletions
  1. +2
    -2
      libs/boost/Makefile
  2. +27
    -2
      libs/boost/patches/001-uclibc-asio.patch
  3. +2
    -2
      libs/boost/patches/002-utime-filesystem.patch
  4. +28
    -0
      libs/boost/patches/003-mips-pause.patch
  5. +0
    -21
      libs/boost/patches/101-uclibc-ng-math.patch

+ 2
- 2
libs/boost/Makefile View File

@ -13,7 +13,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=boost PKG_NAME:=boost
PKG_VERSION:=1.71.0 PKG_VERSION:=1.71.0
PKG_SOURCE_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:=$(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/ 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 config boost-fiber-exclude
bool 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 default n
menu "Select Boost Options" menu "Select Boost Options"


+ 27
- 2
libs/boost/patches/001-uclibc-asio.patch View File

@ -1,3 +1,28 @@
From 95d82acc57bb7d8bae431f7a6ce0707aac3ef33f Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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 <thomas.petazzoni@free-electrons.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
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 --- a/boost/asio/detail/impl/eventfd_select_interrupter.ipp
+++ b/boost/asio/detail/impl/eventfd_select_interrupter.ipp +++ b/boost/asio/detail/impl/eventfd_select_interrupter.ipp
@@ -23,11 +23,11 @@ @@ -23,11 +23,11 @@
@ -15,7 +40,7 @@
#include <boost/asio/detail/cstdint.hpp> #include <boost/asio/detail/cstdint.hpp>
#include <boost/asio/detail/eventfd_select_interrupter.hpp> #include <boost/asio/detail/eventfd_select_interrupter.hpp>
#include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/throw_error.hpp>
@@ -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() void eventfd_select_interrupter::open_descriptors()
{ {
@ -32,7 +57,7 @@
# if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) # if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK)
write_descriptor_ = read_descriptor_ = write_descriptor_ = read_descriptor_ =
::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); ::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); ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC);
} }
} }


+ 2
- 2
libs/boost/patches/002-utime-filesystem.patch View File

@ -37,7 +37,7 @@ index 9bba1cf7a..038109d35 100644
# include "limits.h" # include "limits.h"
# else // BOOST_WINDOW_API # else // BOOST_WINDOW_API
@@ -1451,6 +1453,22 @@ namespace detail
@@ -1459,6 +1461,22 @@ namespace detail
system::error_code* ec) system::error_code* ec)
{ {
# ifdef BOOST_POSIX_API # ifdef BOOST_POSIX_API
@ -60,7 +60,7 @@ index 9bba1cf7a..038109d35 100644
struct stat path_stat; struct stat path_stat;
if (error(::stat(p.c_str(), &path_stat)!= 0, 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, error(::utime(p.c_str(), &buf)!= 0 ? BOOST_ERRNO : 0,
p, ec, "boost::filesystem::last_write_time"); p, ec, "boost::filesystem::last_write_time");


+ 28
- 0
libs/boost/patches/003-mips-pause.patch View File

@ -0,0 +1,28 @@
From 5f7cda29add367c5381775a314ec9f90e311457a Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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 <rosenp@gmail.com>
---
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

+ 0
- 21
libs/boost/patches/101-uclibc-ng-math.patch View File

@ -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<class T>
auto quadratic_roots(T const& a, T const& b, T const& c)
{
- using std::copysign;
using std::sqrt;
if constexpr (std::is_integral<T>::value)
{

Loading…
Cancel
Save