diff --git a/devel/electron18/files/patch-third__party_boringssl_BUILD.generated.gni b/devel/electron18/files/patch-third__party_boringssl_BUILD.generated.gni index 1931fff2179a..74cb570c1fa8 100644 --- a/devel/electron18/files/patch-third__party_boringssl_BUILD.generated.gni +++ b/devel/electron18/files/patch-third__party_boringssl_BUILD.generated.gni @@ -1,18 +1,21 @@ --- third_party/boringssl/BUILD.generated.gni.orig 2022-05-19 05:18:00 UTC +++ third_party/boringssl/BUILD.generated.gni -@@ -81,6 +81,7 @@ crypto_sources = [ +@@ -81,8 +81,10 @@ crypto_sources = [ "src/crypto/cpu_aarch64_apple.c", "src/crypto/cpu_aarch64_fuchsia.c", "src/crypto/cpu_aarch64_linux.c", + "src/crypto/cpu_aarch64_openbsd.c", "src/crypto/cpu_aarch64_win.c", "src/crypto/cpu_arm.c", ++ "src/crypto/cpu_arm_freebsd.c", "src/crypto/cpu_arm_linux.c", -@@ -184,6 +185,7 @@ crypto_sources = [ + "src/crypto/cpu_arm_linux.h", + "src/crypto/cpu_intel.c", +@@ -184,6 +186,7 @@ crypto_sources = [ "src/crypto/rand_extra/deterministic.c", "src/crypto/rand_extra/forkunsafe.c", "src/crypto/rand_extra/fuchsia.c", + "src/crypto/rand_extra/arc4random.c", "src/crypto/rand_extra/passive.c", "src/crypto/rand_extra/rand_extra.c", "src/crypto/rand_extra/windows.c", diff --git a/devel/electron18/files/patch-third__party_boringssl_src_crypto_cpu__arm__freebsd.c b/devel/electron18/files/patch-third__party_boringssl_src_crypto_cpu__arm__freebsd.c new file mode 100644 index 000000000000..19f3a785fdd8 --- /dev/null +++ b/devel/electron18/files/patch-third__party_boringssl_src_crypto_cpu__arm__freebsd.c @@ -0,0 +1,55 @@ +--- third_party/boringssl/src/crypto/cpu_arm_freebsd.c.orig 2022-07-24 00:49:45 UTC ++++ third_party/boringssl/src/crypto/cpu_arm_freebsd.c +@@ -0,0 +1,52 @@ ++/* Copyright (c) 2016, Google Inc. ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY ++ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION ++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN ++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ ++ ++#include "internal.h" ++ ++#if defined(OPENSSL_ARM) && defined(OPENSSL_FREEBSD) && \ ++ !defined(OPENSSL_STATIC_ARMCAP) ++#include ++#include ++ ++#include ++#include ++ ++extern uint32_t OPENSSL_armcap_P; ++ ++void OPENSSL_cpuid_setup(void) { ++ unsigned long hwcap = 0, hwcap2 = 0; ++ ++ elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); ++ elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2); ++ ++ // Matching OpenSSL, only report other features if NEON is present. ++ if (hwcap & HWCAP_NEON) { ++ OPENSSL_armcap_P |= ARMV7_NEON; ++ ++ if (hwcap2 & HWCAP2_AES) { ++ OPENSSL_armcap_P |= ARMV8_AES; ++ } ++ if (hwcap2 & HWCAP2_PMULL) { ++ OPENSSL_armcap_P |= ARMV8_PMULL; ++ } ++ if (hwcap2 & HWCAP2_SHA1) { ++ OPENSSL_armcap_P |= ARMV8_SHA1; ++ } ++ if (hwcap2 & HWCAP2_SHA2) { ++ OPENSSL_armcap_P |= ARMV8_SHA256; ++ } ++ } ++} ++ ++#endif // OPENSSL_ARM && OPENSSL_OPENBSD && !OPENSSL_STATIC_ARMCAP diff --git a/devel/electron18/files/patch-third__party_skia_src_core_SkCpu.cpp b/devel/electron18/files/patch-third__party_skia_src_core_SkCpu.cpp index 07980a5259a6..784aa9b6bf91 100644 --- a/devel/electron18/files/patch-third__party_skia_src_core_SkCpu.cpp +++ b/devel/electron18/files/patch-third__party_skia_src_core_SkCpu.cpp @@ -1,26 +1,49 @@ --- third_party/skia/src/core/SkCpu.cpp.orig 2022-05-19 03:51:39 UTC +++ third_party/skia/src/core/SkCpu.cpp @@ -73,6 +73,23 @@ return features; } +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__) + #include + #ifndef ID_AA64ISAR0_CRC32_VAL + #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 + #endif + + static uint32_t read_cpu_features() { + uint32_t features = 0; + uint64_t id_aa64isar0; + + id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); + if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) { + features |= SkCpu::CRC32; + } + return features; + } + #elif defined(SK_CPU_ARM64) && __has_include() #include +@@ -115,6 +132,22 @@ + return features; + } + ++#elif defined(SK_CPU_ARM32) && defined(__FreeBSD__) ++ #include ++ ++ static uint32_t read_cpu_features() { ++ unsigned long hwcaps = 0; ++ uint32_t features = 0; ++ ++ elf_aux_info(AT_HWCAP, (void *)&hwcaps, sizeof hwcaps); ++ if (hwcaps & HWCAP_NEON) { ++ features |= SkCpu::NEON; ++ if (hwcaps & HWCAP_VFPv4) { ++ features |= SkCpu::NEON_FMA|SkCpu::VFP_FP16; ++ } ++ } ++ return features; ++ } + #elif defined(SK_CPU_ARM32) && __has_include() && \ + (!defined(__ANDROID_API__) || __ANDROID_API__ >= 18) + // sys/auxv.h will always be present in the Android NDK due to unified diff --git a/devel/electron18/files/patch-v8_src_base_platform_platform-freebsd.cc b/devel/electron18/files/patch-v8_src_base_platform_platform-freebsd.cc index 43a6fe33253a..8785e355c9d8 100644 --- a/devel/electron18/files/patch-v8_src_base_platform_platform-freebsd.cc +++ b/devel/electron18/files/patch-v8_src_base_platform_platform-freebsd.cc @@ -1,32 +1,32 @@ --- v8/src/base/platform/platform-freebsd.cc.orig 2022-05-11 07:09:01 UTC +++ v8/src/base/platform/platform-freebsd.cc @@ -43,14 +43,10 @@ TimezoneCache* OS::CreateTimezoneCache() { return new PosixDefaultTimezoneCache(); } -static unsigned StringToLong(char* buffer) { - return static_cast(strtol(buffer, nullptr, 16)); -} - std::vector OS::GetSharedLibraryAddresses() { std::vector result; int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()}; - size_t miblen = sizeof(mib) / sizeof(mib[0]); + unsigned int miblen = sizeof(mib) / sizeof(mib[0]); size_t buffer_size; if (sysctl(mib, miblen, nullptr, &buffer_size, nullptr, 0) == 0) { // Overallocate the buffer by 1/3 to account for concurrent @@ -82,8 +78,13 @@ std::vector OS::GetSharedLib lib_name = std::string(path); } result.push_back(SharedLibraryAddress( -+#if defined(__i386__) || defined(OS_FREEBSD) ++#if defined(__i386__) || defined(__arm__) || defined(OS_FREEBSD) + lib_name, static_cast(map->kve_start), + static_cast(map->kve_end))); +#else lib_name, reinterpret_cast(map->kve_start), reinterpret_cast(map->kve_end))); +#endif } start += ssize; diff --git a/devel/electron18/files/patch-v8_src_codegen_arm_cpu-arm.cc b/devel/electron18/files/patch-v8_src_codegen_arm_cpu-arm.cc new file mode 100644 index 000000000000..b80cc065e78c --- /dev/null +++ b/devel/electron18/files/patch-v8_src_codegen_arm_cpu-arm.cc @@ -0,0 +1,18 @@ +--- v8/src/codegen/arm/cpu-arm.cc.orig 2022-07-25 18:25:18 UTC ++++ v8/src/codegen/arm/cpu-arm.cc +@@ -2,12 +2,15 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + ++#include "include/v8config.h" ++ + // CPU specific code for arm independent of OS goes here. + #ifdef __arm__ + #ifdef __QNXNTO__ + #include // for cache flushing. + #undef MAP_TYPE + #elif V8_OS_FREEBSD ++#include + #include // for cache flushing + #include + #elif V8_OS_STARBOARD