From cd567301def1b48dbc0d9c51b7b693ffe13906bf Mon Sep 17 00:00:00 2001 From: Arnout Vandecappelle Date: Sun, 18 May 2025 14:11:31 +0200 Subject: [PATCH] package/qt5/qt5webengine: fix thumb detection logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a patch that removes part of the logic that attempts to detect if thumb is supported. This logic simply doesn't work at all in the Buildroot context. In fact, thumb is supported on all 32-bit ARM on which we can build qt5webengine. Fixes: WARNING: Thumb instruction set is required to build ffmpeg for QtWebEngine. [...] FAILED: obj/third_party/ffmpeg/ffmpeg_internal/vp8.o [...] -c ../../3rdparty/chromium/third_party/ffmpeg/libavcodec/vp8.c -o obj/third_party/ffmpeg/ffmpeg_internal/vp8.o {standard input}: Assembler messages: {standard input}:1119: Error: bad instruction `ldrhcs r0,[ip],#2' {standard input}:1156: Error: bad instruction `ldrhcs r9,[ip],#2' {standard input}:1190: Error: bad instruction `ldrhcs lr,[ip],#2' {standard input}:1253: Error: bad instruction `ldrhcs r9,[r7],#2' [...] Signed-off-by: Arnout Vandecappelle Cc: Gaƫl PORTAY Signed-off-by: Julien Olivain (cherry picked from commit 2b2120dc4a56c88314f8d94546c9a9120bb45527) Signed-off-by: Thomas Perale --- ...move-some-of-the-thumb-detection-log.patch | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 package/qt5/qt5webengine/0003-configure.pri-remove-some-of-the-thumb-detection-log.patch diff --git a/package/qt5/qt5webengine/0003-configure.pri-remove-some-of-the-thumb-detection-log.patch b/package/qt5/qt5webengine/0003-configure.pri-remove-some-of-the-thumb-detection-log.patch new file mode 100644 index 0000000000..57ed3558bc --- /dev/null +++ b/package/qt5/qt5webengine/0003-configure.pri-remove-some-of-the-thumb-detection-log.patch @@ -0,0 +1,69 @@ +From b00f7b41ffdee03f9982287d61c2fa21ebee5e6b Mon Sep 17 00:00:00 2001 +From: Arnout Vandecappelle +Date: Sat, 17 May 2025 22:09:32 +0200 +Subject: [PATCH] configure.pri: remove some of the thumb detection logic + +The hasThumbFlag test has a roundabout way of discovering whether thumb +is available. It looks at the -mthumb and -marm flag (which does make +some sense), but then it tries to look at -march to determine which ARM +architecture version is used. That test doesn't work if GCC is +configured for a default target architecture and no -march is passed on +the command line. + +In Buildroot, we don't pass any -mthumb, -marm or -march in CFLAGS +because all of that is included in the toolchain wrapper. Therefore, the +logic has nothing to determine the target ARM ISA version and returns +false. + +As a result, nothing is passed down to gn, and gn adds -marm to the +build. There is in fact a warning about this: + + WARNING: Thumb instruction set is required to build ffmpeg for QtWebEngine. + +but since it's just a warning, it gets ignored. + +Indeed, the build does fail (when ffmpeg is built, i.e. when +BR2_PACKAGE_QT5WEBENGINE_PROPRIETARY_CODECS is enabled) with: + + FAILED: obj/third_party/ffmpeg/ffmpeg_internal/vp8.o + [...] + {standard input}: Assembler messages: + {standard input}:1119: Error: bad instruction `ldrhcs r0,[ip],#2' + {standard input}:1156: Error: bad instruction `ldrhcs r9,[ip],#2' + +In practice, the architecture version doesn't really matter, because all +the architectures supported by JSCore have thumb. + +Therefore, remove the logic for detecting if the CPU architecture +supports thumb. Do keep the -marm and -mthumb logic, even though in +Buildroot it doesn't do anything, and the warning gets ignored. + +Signed-off-by: Arnout Vandecappelle +Upstream: It's not clear if the same logic about JSCore applies in +upstream, so not sent. +--- + configure.pri | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/configure.pri b/configure.pri +index 8da334c83..3ff298e9f 100644 +--- a/configure.pri ++++ b/configure.pri +@@ -370,14 +370,6 @@ defineTest(qtConfTest_hasThumbFlag) { + !isEmpty(FLAG): return(true) + FLAG = $$qtwebengine_extractCFlag("-marm") + !isEmpty(FLAG): return(false) +- +- MARCH = $$qtwebengine_extractCFlag("-march=.*") +- MARMV = $$replace(MARCH, "armv",) +- !isEmpty(MARMV) { +- MARMV = $$split(MARMV,) +- MARMV = $$member(MARMV, 0) +- } +- if (isEmpty(MARMV) | lessThan(MARMV, 7)): return(false) + # no flag assume mthumb + return(true) + } +-- +2.49.0 +