1 diff -ruN qt-everywhere-opensource-src-4.6.2.orig/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp qt-everywhere-opensource-src-4.6.2/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp
2 --- qt-everywhere-opensource-src-4.6.2.orig/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp 2010-02-11 16:55:20.000000000 +0100
3 +++ qt-everywhere-opensource-src-4.6.2/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Collector.cpp 2010-02-25 04:34:49.855131784 +0100
8 +#if defined(__UCLIBC__)
9 +// versions of uClibc 0.9.28 and below do not have
10 +// pthread_getattr_np or pthread_attr_getstack.
11 +#if __UCLIBC_MAJOR__ == 0 && \
12 + (__UCLIBC_MINOR__ < 9 || \
13 + (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 30))
14 +#define UCLIBC_USE_PROC_SELF_MAPS 1
15 +#include <stdio_ext.h>
16 +extern int *__libc_stack_end;
24 return static_cast<void*>(pTib->StackBase);
26 return currentThreadStackBaseQNX();
28 - return hpux_get_stack_base();
29 #elif PLATFORM(SOLARIS)
34 - pthread_t thread = pthread_self();
35 - struct __pthrdsinfo threadinfo;
37 - int regbufsize = sizeof regbuf;
39 - if (pthread_getthrds_np(&thread, PTHRDSINFO_QUERY_ALL,
40 - &threadinfo, sizeof threadinfo,
41 - ®buf, ®bufsize) == 0)
42 - return threadinfo.__pi_stackaddr;
45 #elif PLATFORM(OPENBSD)
46 pthread_t thread = pthread_self();
49 get_thread_info(find_thread(NULL), &threadInfo);
50 return threadInfo.stack_end;
52 +#ifdef UCLIBC_USE_PROC_SELF_MAPS
53 + // Read /proc/self/maps and locate the line whose address
54 + // range contains __libc_stack_end.
55 + FILE *file = fopen("/proc/self/maps", "r");
58 + __fsetlocking(file, FSETLOCKING_BYCALLER);
61 + while (!feof_unlocked(file)) {
62 + if (getdelim(&line, &lineLen, '\n', file) <= 0)
67 + if (sscanf (line, "%lx-%lx", &from, &to) != 2)
69 + if (from <= (long)__libc_stack_end && (long)__libc_stack_end < to) {
72 +#ifdef _STACK_GROWS_UP
73 + return (void *)from;
83 static void* stackBase = 0;
84 static size_t stackSize = 0;
85 static pthread_t stackThread;
86 pthread_t thread = pthread_self();
87 if (stackBase == 0 || thread != stackThread) {
88 +#if defined(QT_LINUXBASE)
89 + // LinuxBase is missing pthread_getattr_np - resolve it once at runtime instead
90 + // see http://bugs.linuxbase.org/show_bug.cgi?id=2364
91 + typedef int (*GetAttrPtr)(pthread_t, pthread_attr_t *);
92 + static int (*pthread_getattr_np_ptr)(pthread_t, pthread_attr_t *) = 0;
93 + if (!pthread_getattr_np_ptr)
94 + *(void **)&pthread_getattr_np_ptr = dlsym(RTLD_DEFAULT, "pthread_getattr_np");
97 pthread_attr_init(&sattr);
98 #if HAVE(PTHREAD_NP_H) || PLATFORM(NETBSD)
99 // e.g. on FreeBSD 5.4, neundorf@kde.org
100 pthread_attr_get_np(thread, &sattr);
101 +#elif defined(QT_LINUXBASE)
102 + if (pthread_getattr_np_ptr)
103 + pthread_getattr_np_ptr(thread, &sattr);
105 // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
106 pthread_getattr_np(thread, &sattr);
108 stackThread = thread;
110 return static_cast<char*>(stackBase) + stackSize;
112 #elif PLATFORM(WINCE)