Skip to contentSkip to conversation

package/gcc: fix gcc12 with uClibc

PATCH Andreas Ziegler 1 participant 1 message Dec 22, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andreas Ziegler

author Tested-by
#1 lore raw

Fixes a recursive call to __nothrow_wait_cv::wait() in libstdc++-v3/src/c++11/compatibility-condvar.cc which occurs whenever a C++ application (gcc12 +uClibc) calls std::condition_variable::wait()

Also observed with: mpd using liburing.

Quoted 54 lines · Gleb Mazovetskiy

GCC 12 produces broken binaries when used with uClibc. E.g. gdb crashes on startup.

This adds a patch to address the issue.
The patch is from:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105730#c8

---
 .../gcc/12.2.0/0002-fix-condvar-compat.patch  | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/gcc/12.2.0/0002-fix-condvar-compat.patch
package/gcc/12.2.0/0002-fix-condvar-compat.patch new file +33 -1
new file mode 100644
index 0000000000..9bbd481dbe
@@ -0,0 +1,33 @@
+--- a/libstdc++-v3/src/c++11/compatibility-condvar.cc
++++ b/libstdc++-v3/src/c++11/compatibility-condvar.cc
+@@ -67,6 +67,22 @@ _GLIBCXX_END_NAMESPACE_VERSION
+     && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
+ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+ {
++namespace
++{
++  std::__condvar std::condition_variable::* __base_member;
++
++  template<std::__condvar std::condition_variable::*X>
++    struct cracker
++    {
++      static std::__condvar std::condition_variable::* value;
++    };
++  template<std::__condvar std::condition_variable::*X>
++    std::__condvar std::condition_variable::*
++      cracker<X>::value = __base_member = X;
++
++  template class cracker<&std::condition_variable::_M_cond>;
++}
++
+ struct __nothrow_wait_cv : std::condition_variable
+ {
+   void wait(std::unique_lock<std::mutex>&) noexcept;
+@@ -76,7 +92,7 @@ __attribute__((used))
+ void
+ __nothrow_wait_cv::wait(std::unique_lock<std::mutex>& lock) noexcept
+ {
+-  this->condition_variable::wait(lock);
++  (this->*__base_member).wait(*lock.mutex());
+ }
+ } // namespace __gnu_cxx
--
Quoted 3 lines

2.37.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot