mirror of
http://code.qt.io/yocto/meta-qt6.git
synced 2026-01-01 13:58:07 +00:00
qtbase: fix qsimd build for x86
Temporary fix until merged in qtbase. Change-Id: Ie660b3d19222e48cd3fd2512cc37f51fd07ca475 Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io>
This commit is contained in:
parent
20f186a3ce
commit
8ff564fb98
|
|
@ -0,0 +1,112 @@
|
|||
From 48fd6a9af481ebd499f2fb1abdd7cf69383ed246 Mon Sep 17 00:00:00 2001
|
||||
From: Thiago Macieira <thiago.macieira@intel.com>
|
||||
Date: Wed, 23 Feb 2022 12:01:47 -0800
|
||||
Subject: [PATCH] qsimd.cpp: fix _FORTIFY_SOURCE=2 builds
|
||||
|
||||
That option makes printf() and some other functions become always_inline
|
||||
functions with extent checking. Unfortunately, that also means GCC fails
|
||||
to inline them when we're not compiling for the same target as
|
||||
X86_BASELINE. So we have to force all other includes but qsimd_p.h to be
|
||||
the baseline too.
|
||||
|
||||
Fixes: QTBUG-101198
|
||||
Change-Id: Ibf4acec0f166495998f7fffd16d685d537d9e409
|
||||
---
|
||||
src/corelib/CMakeLists.txt | 1 +
|
||||
src/corelib/global/qsimd.cpp | 47 ++++++++++++++++++++++++------------
|
||||
2 files changed, 32 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
|
||||
index ffd22d6884..89abd8d863 100644
|
||||
--- a/src/corelib/CMakeLists.txt
|
||||
+++ b/src/corelib/CMakeLists.txt
|
||||
@@ -287,6 +287,7 @@ _qt_internal_setup_deploy_support()
|
||||
|
||||
set(corelib_no_pch_sources
|
||||
compat/removed_api.cpp
|
||||
+ global/qsimd.cpp
|
||||
)
|
||||
|
||||
foreach(src ${corelib_no_pch_sources})
|
||||
diff --git a/src/corelib/global/qsimd.cpp b/src/corelib/global/qsimd.cpp
|
||||
index d2a0686097..8c19c5bb0e 100644
|
||||
--- a/src/corelib/global/qsimd.cpp
|
||||
+++ b/src/corelib/global/qsimd.cpp
|
||||
@@ -38,10 +38,31 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
-// we need ICC to define the prototype for _rdseed64_step
|
||||
-#define __INTEL_COMPILER_USE_INTRINSIC_PROTOTYPES
|
||||
+#define QT_DO_PRAGMA(text) _Pragma(#text)
|
||||
+#if defined(__clang__)
|
||||
+# define QT_PRAGMA_PUSH_TARGET(tgt) QT_DO_PRAGMA(clang attribute push(__attribute__((target(tgt))), apply_to=function))
|
||||
+# define QT_PRAGMA_POP_TARGET QT_DO_PRAGMA(clang attribute pop)
|
||||
+#elif defined(__GNUC__)
|
||||
+# define QT_PRAGMA_PUSH_TARGET(tgt) QT_DO_PRAGMA(GCC push_options) QT_DO_PRAGMA(GCC target(tgt))
|
||||
+# define QT_PRAGMA_POP_TARGET QT_DO_PRAGMA(GCC pop_options)
|
||||
+#else
|
||||
+# define QT_PRAGMA_PUSH_TARGET(tgt)
|
||||
+# define QT_PRAGMA_POP_TARGET
|
||||
+#endif
|
||||
|
||||
-#include "qsimd_p.h"
|
||||
+#if defined(__SSE2_MATH__)
|
||||
+# define QT_FUNCTION_TARGET_BASELINE __attribute__((target("no-sse3")))
|
||||
+# define QT_FUNCTION_TARGET_STRING_BASELINE_RDRND "no-sse3," QT_FUNCTION_TARGET_STRING_RDRND
|
||||
+QT_PRAGMA_PUSH_TARGET("no-sse3")
|
||||
+#elif defined(__i386__)
|
||||
+# define QT_FUNCTION_TARGET_BASELINE __attribute__((target("no-sse")))
|
||||
+# define QT_FUNCTION_TARGET_STRING_BASELINE_RDRND "no-sse," QT_FUNCTION_TARGET_STRING_RDRND
|
||||
+QT_PRAGMA_PUSH_TARGET("no-sse")
|
||||
+#else
|
||||
+# define QT_FUNCTION_TARGET_BASELINE
|
||||
+#endif
|
||||
+
|
||||
+#include "qglobal_p.h"
|
||||
#include "qalgorithms.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -55,8 +76,6 @@
|
||||
# include "../testlib/3rdparty/valgrind_p.h"
|
||||
#endif
|
||||
|
||||
-#define QT_FUNCTION_TARGET_BASELINE
|
||||
-
|
||||
#if defined(Q_OS_WIN)
|
||||
# if !defined(Q_CC_GNU)
|
||||
# include <intrin.h>
|
||||
@@ -94,6 +113,13 @@
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__SSE2_MATH__) || defined(__i386__)
|
||||
+QT_PRAGMA_POP_TARGET
|
||||
+#endif
|
||||
+
|
||||
+// Our header comes LAST, after the pragma above
|
||||
+#include "qsimd_p.h"
|
||||
+
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(Q_PROCESSOR_ARM)
|
||||
@@ -199,19 +225,8 @@ static inline quint64 detectProcessorFeatures()
|
||||
|
||||
#ifdef Q_PROCESSOR_X86_32
|
||||
# define PICreg "%%ebx"
|
||||
-# define X86_BASELINE "i386"
|
||||
#else
|
||||
# define PICreg "%%rbx"
|
||||
-# define X86_BASELINE "x86-64"
|
||||
-#endif
|
||||
-
|
||||
-#if defined(Q_CC_GNU)
|
||||
-// lower the target for functions in this file
|
||||
-# undef QT_FUNCTION_TARGET_BASELINE
|
||||
-# define QT_FUNCTION_TARGET_BASELINE __attribute__((target("arch=" X86_BASELINE)))
|
||||
-# define QT_FUNCTION_TARGET_STRING_BASELINE_RDRND \
|
||||
- "arch=" X86_BASELINE \
|
||||
- "," QT_FUNCTION_TARGET_STRING_RDRND
|
||||
#endif
|
||||
|
||||
static bool checkRdrndWorks() noexcept;
|
||||
|
|
@ -18,6 +18,7 @@ SRC_URI += "\
|
|||
file://0002-qlibraryinfo-allow-to-set-qt.conf-from-the-outside-u.patch \
|
||||
file://0003-tests-disable-failing-tests.patch \
|
||||
file://0004-Do-not-use-QT_TOOLCHAIN_RELOCATABLE-paths-in-qt.tool.patch \
|
||||
file://0001-qsimd.cpp-fix-_FORTIFY_SOURCE-2-builds.patch \
|
||||
"
|
||||
|
||||
DEPENDS += "\
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user