From acd77ac90fde2eb1f814c035dae2aed314cb080b Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Tue, 29 Jan 2019 07:10:57 +0100 Subject: [PATCH] qt5: request stack size on newer musl systems by LDFLAGS since 1.1.21 musl supports reading the minimal stack size from the PT_GNU_STACK elf header[1]. [1] https://git.musl-libc.org/cgit/musl/commit/?id=7b3348a98c139b4b4238384e52d4b0eb237e4833 --- .../0019-musl-v8-thread-stacksize.patch | 32 ------------------- ...4-musl-mesa-gallium-thread-stacksize.patch | 20 ------------ .../0030-qtscript-fastmalloc-stacksize.patch | 16 ---------- .../0031-qtscript-threading-stacksize.patch | 31 ------------------ srcpkgs/qt5/template | 4 +-- 5 files changed, 2 insertions(+), 101 deletions(-) delete mode 100644 srcpkgs/qt5/patches/0019-musl-v8-thread-stacksize.patch delete mode 100644 srcpkgs/qt5/patches/0024-musl-mesa-gallium-thread-stacksize.patch delete mode 100644 srcpkgs/qt5/patches/0030-qtscript-fastmalloc-stacksize.patch delete mode 100644 srcpkgs/qt5/patches/0031-qtscript-threading-stacksize.patch diff --git a/srcpkgs/qt5/patches/0019-musl-v8-thread-stacksize.patch b/srcpkgs/qt5/patches/0019-musl-v8-thread-stacksize.patch deleted file mode 100644 index d800d2b3ec6..00000000000 --- a/srcpkgs/qt5/patches/0019-musl-v8-thread-stacksize.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- qtwebengine/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc.orig 2018-09-19 13:42:22.591109990 +0200 -+++ qtwebengine/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc 2018-09-19 13:43:38.538113908 +0200 -@@ -12,11 +12,15 @@ - - namespace { - --// Use 2MB default stack size for Native Client, otherwise use system default. - #if defined(__native_client__) -+// Use 2MB default stack size for Native Client - const size_t kDefaultStackSize = 2 * 1024 * 1024; --#else -+#elif defined(__GLIBC__) -+// Use system default for Gnu libc - const size_t kDefaultStackSize = 0; -+#else -+// Use 2MB default stack size for Musl libc -+const size_t kDefaultStackSize = 2 * 1024 * 1024; - #endif - - ---- qtwebengine/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc.orig 2018-09-23 17:42:44.130455819 +0200 -+++ qtwebengine/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc 2018-09-23 17:43:35.195452776 +0200 -@@ -732,6 +732,9 @@ - // Default on AIX is 96kB -- bump up to 2MB - stack_size = 2 * 1024 * 1024; - #endif -+#if !defined(__GLIBC__) -+ stack_size = 2 * 1024 * 1024; -+#endif - } - if (stack_size > 0) { - result = pthread_attr_setstacksize(&attr, stack_size); diff --git a/srcpkgs/qt5/patches/0024-musl-mesa-gallium-thread-stacksize.patch b/srcpkgs/qt5/patches/0024-musl-mesa-gallium-thread-stacksize.patch deleted file mode 100644 index f259a95b6ee..00000000000 --- a/srcpkgs/qt5/patches/0024-musl-mesa-gallium-thread-stacksize.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- qtwebengine/src/3rdparty/chromium/third_party/mesa/src/src/gallium/auxiliary/os/os_thread.h.orig 2018-09-19 17:15:54.558770949 +0200 -+++ qtwebengine/src/3rdparty/chromium/third_party/mesa/src/src/gallium/auxiliary/os/os_thread.h 2018-09-19 17:22:16.914790675 +0200 -@@ -62,6 +62,16 @@ - - sigfillset(&new_set); - pthread_sigmask(SIG_SETMASK, &new_set, &saved_set); -+ -+ pthread_attr_t attr; -+ pthread_attr_init(&attr); -+#if !defined(__GLIBC__) -+ /* For Musl libc set a thread stack size of 2 MiB */ -+ ret = pthread_attr_setstacksize(&attr, 2 * 1024 * 1024); -+ if (ret) -+ return 0; -+#endif -+ -- ret = pthread_create( &thread, NULL, routine, param ); -+ ret = pthread_create( &thread, &attr, routine, param ); - pthread_sigmask(SIG_SETMASK, &saved_set, NULL); - if (ret) diff --git a/srcpkgs/qt5/patches/0030-qtscript-fastmalloc-stacksize.patch b/srcpkgs/qt5/patches/0030-qtscript-fastmalloc-stacksize.patch deleted file mode 100644 index 78a72e9c236..00000000000 --- a/srcpkgs/qt5/patches/0030-qtscript-fastmalloc-stacksize.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp 2018-10-07 21:25:14.377211462 +0200 -+++ qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp 2018-10-07 21:26:13.987214537 +0200 -@@ -1456,7 +1456,12 @@ - pthread_cond_init(&m_scavengeCondition, 0); - m_scavengeThreadActive = true; - pthread_t thread; -+ pthread_attr_t attr; -+ pthread_attr_init(&attr); -+#if !defined(__GLIBC__) -+ pthread_attr_setstacksize(&attr, 2 * 1024 * 1024); -+#endif -- pthread_create(&thread, 0, runScavengerThread, this); -+ pthread_create(&thread, &attr, runScavengerThread, this); - } - - void* TCMalloc_PageHeap::runScavengerThread(void* context) diff --git a/srcpkgs/qt5/patches/0031-qtscript-threading-stacksize.patch b/srcpkgs/qt5/patches/0031-qtscript-threading-stacksize.patch deleted file mode 100644 index dab5e2b35cd..00000000000 --- a/srcpkgs/qt5/patches/0031-qtscript-threading-stacksize.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp.orig 2018-10-07 21:27:22.340218063 +0200 -+++ qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/ThreadingPthreads.cpp 2018-10-07 21:29:30.743224688 +0200 -@@ -168,8 +168,12 @@ - ThreadData* threadData = new ThreadData(); - threadData->entryPoint = entryPoint; - threadData->arg = data; -- -- if (pthread_create(&threadHandle, 0, runThreadWithRegistration, static_cast(threadData))) { -+ pthread_attr_t attr; -+ pthread_attr_init(&attr); -+#if !defined(__GLIBC__) -+ pthread_attr_setstacksize(&attr, 2 * 1024 * 1024); -+#endif -+ if (pthread_create(&threadHandle, &attr, runThreadWithRegistration, static_cast(threadData))) { - LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data); - delete threadData; - return 0; -@@ -180,7 +184,12 @@ - ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*) - { - pthread_t threadHandle; -- if (pthread_create(&threadHandle, 0, entryPoint, data)) { -+ pthread_attr_t attr; -+ pthread_attr_init(&attr); -+#if !defined(__GLIBC__) -+ pthread_attr_setstacksize(&attr, 2 * 1024 * 1024); -+#endif -+ if (pthread_create(&threadHandle, &attr, entryPoint, data)) { - LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data); - return 0; - } diff --git a/srcpkgs/qt5/template b/srcpkgs/qt5/template index b58d84e675a..dfdcfcba845 100644 --- a/srcpkgs/qt5/template +++ b/srcpkgs/qt5/template @@ -1,7 +1,7 @@ # Template file for 'qt5' pkgname=qt5 version=5.11.3 -revision=3 +revision=4 wrksrc="qt-everywhere-src-${version}" build_style=gnu-configure hostmakedepends="cmake clang flex git glib-devel gperf ninja pkg-config @@ -64,7 +64,7 @@ fi CFLAGS="-DOPENSSL_NO_PSK -DOPENSSL_NO_NEXTPROTONEG" CXXFLAGS="${CFLAGS} -Wno-deprecated-declarations -Wno-class-memaccess -Wno-packed-not-aligned" # Required for musl libc -LDFLAGS="-pthread -ldl -fPIE" +LDFLAGS="-pthread -ldl -fPIE -Wl,-z,stack-size=2097152" if [ "$CROSS_BUILD" ]; then # Need some devel packages in the host to build qmake, moc, uic, rcc