Skip to content

Commit e252b51

Browse files
authored
chromium: Fixes for 142 and wrynose compatibility (#965)
* chromium: Fix removing -g and adding -g1 Use DEBUG_LEVELFLAG to set the debug flag straight instead of DEBUG_FLAGS to remove option -g from and add -g1 to. Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> * chromium: Fix musl patches for 142.0.7444.175 Removed patches: * musl/0008-Use-monotonic-clock-for-pthread_cond_timedwait-with-.patch * musl/0015-fix-libc-version-include.patch Modified patches: * musl/0001-mallinfo-implementation-is-glibc-specific.patch * musl/0004-fontconfig-Musl-does-not-have-rand_r-API.patch * musl/0006-debug-Fix-build-with-musl.patch * musl/0007-mallopt-is-glibc-specific-API.patch * musl/0009-Fix-tab-crashes-on-musl.patch * musl/0011-sys-stat.patch Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> * chromium: Use RUST_TARGET_SYS in do_copy_clang_library() RUST_TARGET_SYS contains the complete system name that Chromium needs to find static libraries from the CLANG runtime. Tweak this system name according to Chromium needs. Tested with MACHINE=raspberrypi3 which uses RUST_TARGET_SYS=armv7-oe-linux-gnueabihf, which needs to be changed into armv7-unknown-linux-gnueabihf for CLANG. Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> * chromium: Add a patch to fix build against GLIBC 2.43 Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> * meta-chromium: Add wrynose to LAYERSERIES_COMPAT The Yocto 6.0 release will happen soon and oe-core and meta-oe already changed their core name to wrynose from whinlatter. Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> --------- Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
1 parent 407e3ac commit e252b51

11 files changed

Lines changed: 76 additions & 137 deletions

meta-chromium/conf/layer.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ BBFILE_PATTERN_chromium-browser-layer := "^${LAYERDIR}/"
99
BBFILE_PRIORITY_chromium-browser-layer = "7"
1010

1111
LAYERVERSION_chromium-browser-layer = "1"
12-
LAYERSERIES_COMPAT_chromium-browser-layer = "whinlatter"
12+
LAYERSERIES_COMPAT_chromium-browser-layer = "whinlatter wrynose"
1313

1414
LAYERDEPENDS_chromium-browser-layer = "core openembedded-layer"

meta-chromium/recipes-browser/chromium/chromium-gn.inc

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ SRC_URI += "\
3232
file://0013-Reduce-minimum-browser-window-width-to-480px.patch \
3333
file://0001-Fix-building-gpu_host_impl.cc-on-Linux.patch \
3434
${@ '' if rust_is_newer_than_190(d) else 'file://chromium-142-crabbyavif-rust18x.patch'} \
35+
file://fix-SYS_SECCOMP-redefinition.patch \
3536
"
3637

3738
# ARM/AArch64-specific patches.
@@ -46,14 +47,12 @@ SRC_URI:append:libc-musl = "\
4647
file://musl/0005-__libc_malloc-is-internal-to-glibc.patch \
4748
file://musl/0006-debug-Fix-build-with-musl.patch \
4849
file://musl/0007-mallopt-is-glibc-specific-API.patch \
49-
file://musl/0008-Use-monotonic-clock-for-pthread_cond_timedwait-with-.patch \
5050
file://musl/0009-Fix-tab-crashes-on-musl.patch \
5151
file://musl/0010-pthread_getname_np.patch \
5252
file://musl/0011-sys-stat.patch \
5353
file://musl/0012-credentials-header.patch \
5454
file://musl/0013-fstatat64.patch \
5555
file://musl/0014-no-res-ninit-nclose.patch \
56-
file://musl/0015-fix-libc-version-include.patch \
5756
"
5857

5958
ANY_OF_DISTRO_FEATURES = "opengl vulkan"
@@ -197,39 +196,17 @@ GN_ARGS += "use_lld=true use_gold=false"
197196
# file and other utilities are unable to read a 32-bit binary this size, which
198197
# causes it not to be stripped.
199198
# The solution is two-fold:
200-
# 1. Make sure -g is not passed on 32-bit architectures via DEBUG_FLAGS. -g is
201-
# the same as -g2. -g1 generates an 800MB binary, which is a lot more
202-
# manageable.
199+
# 1. Set DEBUG_LEVELFLAG as needed, which is used in both FULL_OPTIMIZATION
200+
# and DEBUG_OPTIMIZATION.
203201
# 2. Explicitly pass symbol_level=0 to GN. This causes -g0 to be passed
204202
# instead, so that if DEBUG_BUILD is not set GN will not create a huge debug
205203
# binary anyway. Since our compiler flags are passed after GN's, -g0 does
206204
# not cause any issues if DEBUG_BUILD is set, as -g1 will be passed later.
207-
DEBUG_FLAGS:remove:arm = "-g"
208-
DEBUG_FLAGS:append:arm = "-g1"
209-
DEBUG_FLAGS:remove:x86 = "-g"
210-
DEBUG_FLAGS:append:x86 = "-g1"
211-
GN_ARGS += "symbol_level=0"
212-
205+
DEBUG_LEVELFLAG = "-g1"
213206
# For ARM builds, completely remove debug flags that cause binary size issues
214207
# This prevents the "output file too large" linker error on ARM32
215-
CFLAGS:remove:arm = "-g"
216-
CXXFLAGS:remove:arm = "-g"
217-
TARGET_CFLAGS:remove:arm = "-g"
218-
TARGET_CXXFLAGS:remove:arm = "-g"
219-
220-
# As of Chromium 62.0.3202.94 and Yocto Rocko (GCC 7, binutils 2.29), passing
221-
# -g to the compiler results in many linker errors on aarch64, such as:
222-
# obj/third_party/WebKit/Source/modules/payments/libpayments.a(PaymentEventDataConversion.o)(.debug_loc+0x4e25): error: relocation overflow in R_AARCH64_ABS32
223-
DEBUG_FLAGS:remove:aarch64 = "-g"
224-
DEBUG_FLAGS:append:aarch64 = "-g1"
225-
226-
# As of Chromium 60.0.3112.101 and Yocto Pyro (GCC 6, binutils 2.28), passing
227-
# -g to the compiler results in many linker errors on x86_64, such as:
228-
# obj/third_party/WebKit/Source/core/loader/libloader.a(ModuleTreeLinker.o)(.debug_loc+0x1e9a5): error: relocation overflow: reference to local symbol 82 in obj/third_party/WebKit/Source/core/loader/libloader.a(ModuleTreeLinker.o)
229-
# obj/third_party/WebKit/Source/core/libcore_generated.a(ScriptModule.o)(.debug_loc+0x253c): error: relocation overflow: reference to local symbol 31 in obj/third_party/WebKit/Source/core/libcore_generated.a(ScriptModule.o)
230-
# so we have to use the same hack described above.
231-
DEBUG_FLAGS:remove:x86-64 = "-g"
232-
DEBUG_FLAGS:append:x86-64 = "-g1"
208+
DEBUG_LEVELFLAG:arm = ""
209+
GN_ARGS += "symbol_level=0"
233210

234211
# Disable Chrome Remote Desktop (aka Chromoting) support. Building host support
235212
# (so that the machine running this recipe can be controlled remotely from
@@ -491,21 +468,21 @@ do_copy_clang_library () {
491468

492469
lib_file=$(find $(find . -maxdepth 1 \! \( -name latest -o -name '.' \)) \( -name "libclang_rt.builtins-*" -o -name "liborc_rt-*" \))
493470
echo "lib_file = $lib_file"
494-
export ARCH="${TARGET_ARCH}"
471+
export CHROMIUM_TARGET_TRIPLET="$(echo ${RUST_TARGET_SYS} | sed 's:-oe-:-unknown-:')"
495472

496-
mkdir -p "latest/lib/${ARCH}-unknown-linux-gnu"
497-
echo "Executing cp $lib_file latest/lib/${ARCH}-unknown-linux-gnu/"
498-
cp $lib_file "latest/lib/${ARCH}-unknown-linux-gnu/"
499-
cd "latest/lib/${ARCH}-unknown-linux-gnu/" || return
473+
mkdir -p "latest/lib/${CHROMIUM_TARGET_TRIPLET}"
474+
echo "Executing cp $lib_file latest/lib/${CHROMIUM_TARGET_TRIPLET}/"
475+
cp $lib_file "latest/lib/${CHROMIUM_TARGET_TRIPLET}/"
476+
cd "latest/lib/${CHROMIUM_TARGET_TRIPLET}/" || return
500477

501-
for file in *-"${ARCH}".a *-"${ARCH}hf".a; do
478+
for file in *-"${TARGET_ARCH}".a *-"${TARGET_ARCH}hf".a; do
502479
if [ -f "$file" ]; then
503-
new_name=$(echo "$file" | sed -e "s/-${ARCH}hf//" -e "s/-${ARCH}//")
480+
new_name=$(echo "$file" | sed -e "s/-${TARGET_ARCH}hf//" -e "s/-${TARGET_ARCH}//")
504481
mv "$file" "$new_name"
505482
fi
506483
done
507484

508-
native_arch_path="${STAGING_LIBDIR_NATIVE}/clang/latest/lib/${ARCH}-unknown-linux-gnu/"
485+
native_arch_path="${STAGING_LIBDIR_NATIVE}/clang/latest/lib/${CHROMIUM_TARGET_TRIPLET}/"
509486
mkdir -p "$native_arch_path"
510487
echo "Executing cp -r $(ls -d *) $native_arch_path"
511488
cp -r * "$native_arch_path"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Taken from:
2+
https://aur.archlinux.org/cgit/aur.git/tree/0007-qt5-webengine-glibc-2.43-SYS_SECCOMP-as-enum@chromium.patch?h=qt5-webengine
3+
4+
Upstream-Status: Inappropriate [glibc 2.43 fix]
5+
diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
6+
index 8690a96eb01b1..8988836508c7b 100644
7+
--- a/sandbox/linux/system_headers/linux_seccomp.h
8+
+++ b/sandbox/linux/system_headers/linux_seccomp.h
9+
@@ -6,6 +6,7 @@
10+
#define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SECCOMP_H_
11+
12+
#include <stdint.h>
13+
+#include <signal.h>
14+
#include <sys/ioctl.h>
15+
16+
#include "build/build_config.h"

meta-chromium/recipes-browser/chromium/files/musl/0001-mallinfo-implementation-is-glibc-specific.patch

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metric
1919
index 873a328aa2..5d7d8c11ad 100644
2020
--- a/base/process/process_metrics_posix.cc
2121
+++ b/base/process/process_metrics_posix.cc
22-
@@ -107,7 +107,7 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
22+
@@ -108,7 +108,7 @@ void IncreaseFdLimitTo(unsigned int max_
2323

2424
#endif // !BUILDFLAG(IS_FUCHSIA)
2525

@@ -28,7 +28,7 @@ index 873a328aa2..5d7d8c11ad 100644
2828
namespace {
2929

3030
size_t GetMallocUsageMallinfo() {
31-
@@ -125,7 +125,7 @@ size_t GetMallocUsageMallinfo() {
31+
@@ -126,7 +126,7 @@ size_t GetMallocUsageMallinfo() {
3232
}
3333

3434
} // namespace
@@ -37,7 +37,7 @@ index 873a328aa2..5d7d8c11ad 100644
3737
// BUILDFLAG(IS_ANDROID)
3838

3939
size_t ProcessMetrics::GetMallocUsage() {
40-
@@ -133,9 +133,9 @@ size_t ProcessMetrics::GetMallocUsage() {
40+
@@ -134,9 +134,9 @@ size_t ProcessMetrics::GetMallocUsage()
4141
malloc_statistics_t stats = {0};
4242
malloc_zone_statistics(nullptr, &stats);
4343
return stats.size_in_use;
@@ -53,25 +53,26 @@ diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_
5353
index f056277d4b..515d779cce 100644
5454
--- a/base/trace_event/malloc_dump_provider.cc
5555
+++ b/base/trace_event/malloc_dump_provider.cc
56-
@@ -186,6 +186,7 @@ void ReportAppleAllocStats(size_t* total_virtual_size,
56+
@@ -180,6 +180,7 @@ void ReportAppleAllocStats(size_t* total
5757

58-
#if (BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
59-
(!BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
58+
#if (PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
59+
(!PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
6060
+ defined(__GLIBC__) && \
6161
!BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA))
6262
void ReportMallinfoStats(ProcessMemoryDump* pmd,
6363
size_t* total_virtual_size,
64-
@@ -358,8 +359,10 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
64+
@@ -384,9 +385,11 @@ bool MallocDumpProvider::OnMemoryDump(co
6565
#elif BUILDFLAG(IS_FUCHSIA)
6666
// TODO(fuchsia): Port, see https://crbug.com/706592.
6767
#else
6868
+#ifdef __GLIBC__
6969
ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
7070
&allocated_objects_size, &allocated_objects_count);
71-
+#endif
7271
#endif
72+
+#endif
7373

7474
MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc");
75+
outer_dump->AddScalar("virtual_size", MemoryAllocatorDump::kUnitsBytes,
7576
diff --git a/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h
7677
index 7392898797..0bf7c4ad99 100644
7778
--- a/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h
@@ -108,7 +109,7 @@ diff --git a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc b/t
108109
index 4f1d517869..0afd270817 100644
109110
--- a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
110111
+++ b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
111-
@@ -38,7 +38,7 @@ bool MemoryUsage::IsSupported() {
112+
@@ -42,7 +42,7 @@ bool MemoryUsage::IsSupported() {
112113

113114
MemoryUsage GetMemoryUsage() {
114115
MemoryUsage result;

meta-chromium/recipes-browser/chromium/files/musl/0004-fontconfig-Musl-does-not-have-rand_r-API.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ Upstream-Status: Pending
99
Signed-off-by: Khem Raj <raj.khem@gmail.com>
1010

1111
---
12-
third_party/fontconfig/include/config.h | 2 +-
12+
third_party/fontconfig/include/meson-config.h | 2 +-
1313
1 file changed, 1 insertion(+), 1 deletion(-)
1414

15-
diff --git a/third_party/fontconfig/include/config.h b/third_party/fontconfig/include/config.h
15+
diff --git a/third_party/fontconfig/include/meson-config.h b/third_party/fontconfig/include/meson-config.h
1616
index 9087ca0c15..3e4c56a519 100644
17-
--- a/third_party/fontconfig/include/config.h
18-
+++ b/third_party/fontconfig/include/config.h
19-
@@ -157,7 +157,7 @@
17+
--- a/third_party/fontconfig/include/meson-config.h
18+
+++ b/third_party/fontconfig/include/meson-config.h
19+
@@ -98,7 +98,7 @@
20+
2021
#define HAVE_RANDOM 1
2122

22-
/* Define to 1 if you have the `random_r' function. */
2323
-#define HAVE_RANDOM_R 1
2424
+/* #undef HAVE_RANDOM_R */
2525

26-
/* Define to 1 if you have the `rand_r' function. */
2726
#define HAVE_RAND_R 1
27+

meta-chromium/recipes-browser/chromium/files/musl/0006-debug-Fix-build-with-musl.patch

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
2222
index 3debc8bd07..0cc88aa79f 100644
2323
--- a/base/debug/stack_trace.cc
2424
+++ b/base/debug/stack_trace.cc
25-
@@ -281,14 +281,14 @@ std::string StackTrace::ToString() const {
26-
}
27-
std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
25+
@@ -366,7 +366,7 @@
26+
27+
std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
2828
std::stringstream stream;
2929
-#if !defined(__UCLIBC__) && !defined(_AIX)
3030
+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
3131
OutputToStreamWithPrefix(&stream, prefix_string);
3232
#endif
3333
return stream.str();
34+
@@ -390,7 +390,7 @@
3435
}
3536

3637
std::ostream& operator<<(std::ostream& os, const StackTrace& s) {

meta-chromium/recipes-browser/chromium/files/musl/0007-mallopt-is-glibc-specific-API.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ diff --git a/base/allocator/allocator_check.cc b/base/allocator/allocator_check.
1414
index 0ac9fa1975..b6338c8285 100644
1515
--- a/base/allocator/allocator_check.cc
1616
+++ b/base/allocator/allocator_check.cc
17-
@@ -11,7 +11,7 @@
18-
#include "base/allocator/partition_allocator/shim/winheap_stubs_win.h"
17+
@@ -16,7 +16,7 @@
18+
#include "partition_alloc/shim/winheap_stubs_win.h"
1919
#endif
2020

2121
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)

meta-chromium/recipes-browser/chromium/files/musl/0008-Use-monotonic-clock-for-pthread_cond_timedwait-with-.patch

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)