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
This commit is contained in:
Enno Boland 2019-01-29 07:10:57 +01:00 committed by Enno Boland
parent fee8fc5b52
commit acd77ac90f
5 changed files with 2 additions and 101 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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<void*>(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<void*>(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;
}

View File

@ -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