macOS: Disable PCRE JIT when running under Rosetta

Although the Apple docs claim that Rosetta can translate apps that
contain just-in-time (JIT) compilers, it seems to have problems with
the PCRE JIT.

https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment

To be on the safe side we disable the JIT explicitly when detecting that
we are running under Rosetta. It's already disabled when we're running
on macOS ARM natively (see 2f8df4d1a87df9dd67913b016171dac20839d16e).

Fixes: QTBUG-97085
Pick-to: 6.2
Change-Id: I0e133939f28087560d4bc8354b7e49013e94a9f9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-10-04 15:31:52 +02:00
parent 60caec953f
commit b689d8dccd

View File

@ -52,6 +52,10 @@
#include <QtCore/qatomic.h>
#include <QtCore/qdatastream.h>
#if defined(Q_OS_MACOS)
#include <QtCore/private/qcore_mac_p.h>
#endif
#define PCRE2_CODE_UNIT_WIDTH 16
#include <pcre2.h>
@ -1011,6 +1015,8 @@ static bool isJitEnabled()
#ifdef QT_DEBUG
return false;
#elif defined(Q_OS_MACOS)
return !qt_mac_runningUnderRosetta();
#else
return true;
#endif