diff options
author | Tobias C. Berner <tcberner@FreeBSD.org> | 2022-08-20 11:36:28 +0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-08-31 06:51:59 +0000 |
commit | b1c57d13eecc208408b7ed05f888d7625fb6e251 (patch) | |
tree | 5b1039a70b10d45dc361c5d5b0320a12df84b20d /src | |
parent | fe92b080658f0d8609e2a2a69e5ec2b51dd7bf9d (diff) |
qthread.h: fix logic for Q_OS_FREEBSD and add support for 32bit FreeBSD
Fails to compile on i386 on FreeBSD with:
In file included from /wrkdirs/usr/ports/devel/qt6-base/work/qtbase-everywhere-src-6.3.1/src/corelib/thread/qmutex.cpp:49:
/wrkdirs/usr/ports/devel/qt6-base/work/qtbase-everywhere-src-6.3.1/src/corelib/thread/qthread.h:201:13: error: invalid operand for instruction
__asm__("movq %%fs:%c1, %0" : "=r" (tid) : "i" (2 * sizeof(void*)) : );
^
<inline asm>:1:14: note: instantiated into assembly here
movq %fs:8, %edi
^~~~
1 error generated.
Pick-to: 6.2 6.3 6.4
Change-Id: I0a71e4631d7b6d452083d3ca8e35759e5dc563d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qthread.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index 4cea76cf77..d856d8daa8 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -155,12 +155,12 @@ inline Qt::HANDLE QThread::currentThreadId() noexcept Qt::HANDLE tid; // typedef to void* static_assert(sizeof(tid) == sizeof(void*)); // See https://akkadia.org/drepper/tls.pdf for x86 ABI -#if defined(Q_PROCESSOR_X86_32) && defined(Q_OS_LINUX) && defined(__GLIBC__) // x86 32-bit always uses GS +#if defined(Q_PROCESSOR_X86_32) && ((defined(Q_OS_LINUX) && defined(__GLIBC__)) || defined(Q_OS_FREEBSD)) // x86 32-bit always uses GS __asm__("movl %%gs:%c1, %0" : "=r" (tid) : "i" (2 * sizeof(void*)) : ); #elif defined(Q_PROCESSOR_X86_64) && defined(Q_OS_DARWIN64) // 64bit macOS uses GS, see https://github.com/apple/darwin-xnu/blob/master/libsyscall/os/tsd.h __asm__("movq %%gs:0, %0" : "=r" (tid) : : ); -#elif defined(Q_PROCESSOR_X86_64) && (defined(Q_OS_LINUX) && defined(__GLIBC__)) || defined(Q_OS_FREEBSD) +#elif defined(Q_PROCESSOR_X86_64) && ((defined(Q_OS_LINUX) && defined(__GLIBC__)) || defined(Q_OS_FREEBSD)) // x86_64 Linux, BSD uses FS __asm__("movq %%fs:%c1, %0" : "=r" (tid) : "i" (2 * sizeof(void*)) : ); #elif defined(Q_PROCESSOR_X86_64) && defined(Q_OS_WIN) |