File partition_alloc-no-lto.patch of Package nodejs-electron
Compile files which declare functions in inline assembly without LTO due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57703
--- src/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn.old 2022-10-01 13:53:03.367797474 +0200
+++ src/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn 2022-10-05 14:23:53.999860356 +0200
@@ -90,6 +90,33 @@ if (!is_debug || partition_alloc_optimiz
_add_configs += [ "//build/config/compiler:no_optimize" ]
}
+if (use_starscan) {
+ static_library("partition_alloc_asm") {
+ if (gcc_lto) {
+ configs -= [ "//build/config/compiler:gcc_lto" ]
+ }
+ if (current_cpu == "x64") {
+ assert(pcscan_stack_supported)
+ sources = [ "starscan/stack/asm/x64/push_registers_asm.cc" ]
+ } else if (current_cpu == "x86") {
+ assert(pcscan_stack_supported)
+ sources = [ "starscan/stack/asm/x86/push_registers_asm.cc" ]
+ } else if (current_cpu == "arm") {
+ assert(pcscan_stack_supported)
+ sources = [ "starscan/stack/asm/arm/push_registers_asm.cc" ]
+ } else if (current_cpu == "arm64") {
+ assert(pcscan_stack_supported)
+ sources = [ "starscan/stack/asm/arm64/push_registers_asm.cc" ]
+ } else if (current_cpu == "riscv64") {
+ assert(pcscan_stack_supported)
+ sources = [ "starscan/stack/asm/riscv64/push_registers_asm.cc" ]
+ } else {
+ assert(!pcscan_stack_supported)
+ # To support a trampoline for another arch, please refer to v8/src/heap/base.
+ }
+ }
+}
+
component("raw_ptr") {
# `gn check` is unhappy with most `#includes` when PA isn't
# actually built.
@@ -497,25 +524,10 @@ if (is_clang_or_gcc) {
# The Android NDK supports PR_MTE_* macros as of NDK r23.
defines += [ "HAS_PR_MTE_MACROS" ]
}
+ deps = [ ":allocator_base" ]
if (use_starscan) {
- if (current_cpu == "x64") {
- assert(pcscan_stack_supported)
- sources += [ "starscan/stack/asm/x64/push_registers_asm.cc" ]
- } else if (current_cpu == "x86") {
- assert(pcscan_stack_supported)
- sources += [ "starscan/stack/asm/x86/push_registers_asm.cc" ]
- } else if (current_cpu == "arm") {
- assert(pcscan_stack_supported)
- sources += [ "starscan/stack/asm/arm/push_registers_asm.cc" ]
- } else if (current_cpu == "arm64") {
- assert(pcscan_stack_supported)
- sources += [ "starscan/stack/asm/arm64/push_registers_asm.cc" ]
- } else if (current_cpu == "riscv64") {
- assert(pcscan_stack_supported)
- sources += [ "starscan/stack/asm/riscv64/push_registers_asm.cc" ]
- } else {
- # To support a trampoline for another arch, please refer to v8/src/heap/base.
- assert(!pcscan_stack_supported)
+ if (current_cpu == "x64" || current_cpu == "x86" || current_cpu == "arm" || current_cpu == "arm64" || current_cpu == "riscv64") {
+ deps += [ ":partition_alloc_asm" ]
}
}
if (use_freelist_pool_offsets) {
@@ -536,7 +548,6 @@ if (is_clang_or_gcc) {
":memory_tagging",
"//build/config/compiler:wexit_time_destructors",
]
- deps = [ ":allocator_base" ]
public_configs = []
if (is_android) {
# tagging.cc requires __arm_mte_set_* functions.