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>
This commit is contained in:
parent
fe92b08065
commit
b1c57d13ee
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user