webkitgtk: fix build failure with DEBUG_BUILD enabled

It fails to compile webkitgtk when debug build enabled:

| /path_to/tmp/work/core2-64-poky-linux/webkitgtk/2.40.5/webkitgtk-2.40.5/Source/bmalloc/libpas/src/libpas/pas_allocation_result.h:76:1:
  error: inlining failed in call to 'always_inline' 'pas_allocation_result pas_allocation_result_identity(pas_allocation_result)':
  function not considered for inlining
|    76 | pas_allocation_result_identity(pas_allocation_result result)
|       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add a cmake variable WEBKIT_NO_INLINE_HINTS to disable gcc function
attribute `always_inline` when debug build is enabled.

And adjust indent as well.

(From OE-Core rev: 8a33cd60f89685eeda7c5b3513540561df06160d)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Kai Kang
2023-09-05 10:02:09 +08:00
committed by Richard Purdie
parent 0dd973297d
commit 5ea20893d6
2 changed files with 86 additions and 8 deletions

View File

@@ -0,0 +1,76 @@
From 73efe0ea75c3ac4cb088f300acc3de44d5dd3344 Mon Sep 17 00:00:00 2001
From: Kai Kang <kai.kang@windriver.com>
Date: Fri, 11 Aug 2023 14:20:48 +0800
Subject: [PATCH] [CMake] Add a variable to control macro
__PAS_ALWAYS_INLINE_BUT_NOT_INLINE
https://bugs.webkit.org/show_bug.cgi?id=260065
Reviewed by NOBODY (OOPS!).
It fails to compile webkitgtk with option `-Og` of gcc/g++:
| In file included from Source/bmalloc/libpas/src/libpas/pas_heap_page_provider.h:30,
| from Source/bmalloc/libpas/src/libpas/pas_bootstrap_heap_page_provider.h:29,
| from Source/bmalloc/libpas/src/libpas/pas_large_heap_physical_page_sharing_cache.h:29,
| from Source/bmalloc/libpas/src/libpas/pas_basic_heap_page_caches.h:29,
| from Source/bmalloc/libpas/src/libpas/pas_heap_config_utils.h:32,
| from Source/bmalloc/libpas/src/libpas/bmalloc_heap_config.h:34,
| from Source/bmalloc/libpas/src/libpas/bmalloc_heap_inlines.h:34,
| from Source/bmalloc/bmalloc/bmalloc.h:39,
| from Source/bmalloc/bmalloc/bmalloc.cpp:26:
| In function 'pas_allocation_result pas_local_allocator_try_allocate(pas_local_allocator*, size_t, size_t, pas_heap_config, pas_allocator_counts*, pas_allocation_result_filter)',
| inlined from 'pas_allocation_result pas_try_allocate_common_impl_fast(pas_heap_config, pas_allocator_counts*, pas_allocation_result_filter, pas_local_allocator*, size_t, size_t)' at webkitgtk-2.40.2/Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h:85:46,
| inlined from 'pas_allocation_result bmalloc_try_allocate_with_alignment_impl_impl_fast(pas_local_allocator*, size_t, size_t)' at webkitgtk-2.40.2/Source/bmalloc/libpas/src/libpas/bmalloc_heap_inlines.h:59:1,
| inlined from 'pas_allocation_result pas_try_allocate_intrinsic_impl_casual_case(__pas_heap*, size_t, size_t, pas_intrinsic_heap_support*, pas_heap_config, pas_try_allocate_common_fast, pas_try_allocate_common_slow, pas_intrinsic_heap_designation_mode)' at webkitgtk-2.40.2/Source/bmalloc/libpas/src/libpas/pas_try_allocate_intrinsic.h:167:44,
| inlined from 'pas_allocation_result bmalloc_try_allocate_with_alignment_impl_casual_case(size_t, size_t)' at webkitgtk-2.40.2/Source/bmalloc/libpas/src/libpas/bmalloc_heap_inlines.h:59:1:
| webkitgtk-2.40.2/Source/bmalloc/libpas/src/libpas/pas_allocation_result.h:76:1: error: inlining failed in call to 'always_inline' 'pas_allocation_result pas_allocation_result_identity(pas_allocation_result)': function not considered for inlining
| 76 | pas_allocation_result_identity(pas_allocation_result result)
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Add an variable `WEBKIT_NO_INLINE_HINTS` to control macro
__PAS_ALWAYS_INLINE_BUT_NOT_INLINE whether includes function attribute
`always_inline`. It could set the variable to make compilation pass when
gcc option `-Og` is used.
* Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h:
* Source/cmake/WebKitCompilerFlags.cmake:
Upstream-Status: Submitted [https://github.com/WebKit/WebKit/pull/16601]
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h | 2 +-
Source/cmake/WebKitCompilerFlags.cmake | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h b/Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h
index 5d5fb38cddbd..a554f70064eb 100644
--- a/Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h
+++ b/Source/bmalloc/libpas/src/libpas/pas_utils_prefix.h
@@ -44,7 +44,7 @@ __PAS_BEGIN_EXTERN_C;
#define __SUSPICIOUS__
#define __BROKEN__
-#ifdef __OPTIMIZE__
+#if defined(__OPTIMIZE__) && !defined(WEBKIT_NO_INLINE_HINTS)
#define __PAS_ALWAYS_INLINE_BUT_NOT_INLINE __attribute__((__always_inline__))
#else
#define __PAS_ALWAYS_INLINE_BUT_NOT_INLINE
diff --git a/Source/cmake/WebKitCompilerFlags.cmake b/Source/cmake/WebKitCompilerFlags.cmake
index 9b2fecf9a0d3..7cdc2b6afbe0 100644
--- a/Source/cmake/WebKitCompilerFlags.cmake
+++ b/Source/cmake/WebKitCompilerFlags.cmake
@@ -453,3 +453,10 @@ endif ()
# FIXME: Enable pre-compiled headers for all ports <https://webkit.org/b/139438>
set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON)
+
+# It fails to compile with `gcc -Og`
+set(WEBKIT_NO_INLINE_HINTS OFF CACHE BOOL "Disable funtion attribute always_inline for WebKit")
+
+if (WEBKIT_NO_INLINE_HINTS)
+ add_definitions(-DWEBKIT_NO_INLINE_HINTS)
+endif ()
--
2.34.1

View File

@@ -14,6 +14,7 @@ SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
file://reproducibility.patch \
file://0d3344e17d258106617b0e6d783d073b188a2548.patch \
file://check-GST_GL_HAVE_PLATFORM_GLX.patch \
file://0001-CMake-Add-a-variable-to-control-macro-__PAS_ALWAYS_I.patch \
"
SRC_URI[sha256sum] = "7de051a263668621d91a61a5eb1c3771d1a7cec900043d4afef06c326c16037f"
@@ -76,14 +77,15 @@ PACKAGECONFIG[avif] = "-DUSE_AVIF_LOG=ON,-DUSE_AVIF=OFF,libavif"
PACKAGECONFIG[media-recorder] = "-DENABLE_MEDIA_RECORDER=ON,-DENABLE_MEDIA_RECORDER=OFF,gstreamer1.0-plugins-bad"
EXTRA_OECMAKE = " \
-DPORT=GTK \
${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DENABLE_INTROSPECTION=ON', '-DENABLE_INTROSPECTION=OFF', d)} \
${@bb.utils.contains('GIDOCGEN_ENABLED', 'True', '-DENABLE_DOCUMENTATION=ON', '-DENABLE_DOCUMENTATION=OFF', d)} \
-DENABLE_MINIBROWSER=ON \
-DENABLE_BUBBLEWRAP_SANDBOX=OFF \
-DENABLE_GAMEPAD=OFF \
-DUSE_GTK4=ON \
"
-DPORT=GTK \
${@oe.utils.vartrue('GI_DATA_ENABLED', '-DENABLE_INTROSPECTION=ON', '-DENABLE_INTROSPECTION=OFF', d)} \
${@oe.utils.vartrue('GIDOCGEN_ENABLED', '-DENABLE_DOCUMENTATION=ON', '-DENABLE_DOCUMENTATION=OFF', d)} \
${@oe.utils.vartrue('DEBUG_BUILD', '-DWEBKIT_NO_INLINE_HINTS=ON', '-DWEBKIT_NO_INLINE_HINTS=OFFF', d)} \
-DENABLE_MINIBROWSER=ON \
-DENABLE_BUBBLEWRAP_SANDBOX=OFF \
-DENABLE_GAMEPAD=OFF \
-DUSE_GTK4=ON \
"
# Javascript JIT is not supported on ARC
EXTRA_OECMAKE:append:arc = " -DENABLE_JIT=OFF "