Index: modcargo-crates/v8-142.2.0/build/config/compiler/BUILD.gn
--- modcargo-crates/v8-142.2.0/build/config/compiler/BUILD.gn.orig
+++ modcargo-crates/v8-142.2.0/build/config/compiler/BUILD.gn
@@ -195,7 +195,7 @@ declare_args() {
   # This greatly reduces the size of debug builds, at the cost of
   # debugging information which is required by some specialized
   # debugging tools.
-  simple_template_names = is_clang && !is_win && !is_apple
+  simple_template_names = is_clang && !is_win && !is_apple && !is_bsd
 
   # This switch is used to enable -Wexit-time-destructors by default. This
   # warning serves as a flip switch to allow a gradual migration of targets
@@ -299,13 +299,16 @@ config("default_include_dirs") {
 # Compiler instrumentation can introduce dependencies in DSOs to symbols in
 # the executable they are loaded into, so they are unresolved at link-time.
 config("no_unresolved_symbols") {
-  if (!using_sanitizer &&
+  if (!using_sanitizer && !is_bsd &&
       (is_linux || is_chromeos || is_android || is_fuchsia)) {
     ldflags = [
       "-Wl,-z,defs",
       "-Wl,--as-needed",
     ]
   }
+  if (current_cpu == "x86" && is_openbsd) {
+    ldflags = [ "-Wl,-z,notext", "-Wl,--strip-all" ]
+  }
 }
 
 # compiler ---------------------------------------------------------------------
@@ -425,6 +428,10 @@ config("compiler") {
     # --------------------------------
     cflags += [ "-fno-strict-aliasing" ]  # See http://crbug.com/32204
 
+    if (is_openbsd) {
+      ldflags += [ "-Wl,-z,wxneeded" ]
+    }
+
     # Stack protection. ShadowCallStack and Stack protector address the same
     # problems. Therefore, we only enable one or the other. Clang advertises SCS as
     # a stronger alternative to StackProtector, so we give SCS precedence over SP.
@@ -467,7 +474,7 @@ config("compiler") {
     }
 
     # Linker warnings.
-    if (fatal_linker_warnings && !is_apple && current_os != "aix" &&
+    if (fatal_linker_warnings && !is_apple && !is_openbsd && current_os != "aix" &&
         current_os != "zos") {
       ldflags += [ "-Wl,--fatal-warnings" ]
     }
@@ -578,6 +585,10 @@ config("compiler") {
     }
   }
 
+  if (is_openbsd) {
+    ldflags += [ "-Wl,-z,wxneeded" ]
+  }
+
   # Linux-specific compiler flags setup.
   # ------------------------------------
   if (use_icf && (!is_apple || use_lld)) {
@@ -668,7 +679,7 @@ config("compiler") {
     ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
   }
 
-  if (is_clang) {
+  if (is_clang && !is_bsd) {
     cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
     if (save_reproducers_on_lld_crash && use_lld) {
       ldflags += [
@@ -1321,7 +1332,7 @@ config("compiler_cpu_abi") {
     # CPU architecture. We may or may not be doing a cross compile now, so for
     # simplicity we always explicitly set the architecture.
     if (current_cpu == "x64") {
-      if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) {
+      if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device && !is_bsd) {
         cflags += [ "--target=x86_64-unknown-linux-gnu" ]
         ldflags += [ "--target=x86_64-unknown-linux-gnu" ]
       } else {
@@ -1330,7 +1341,7 @@ config("compiler_cpu_abi") {
       }
       cflags += [ "-msse3" ]
     } else if (current_cpu == "x86") {
-      if (is_clang && !is_android && !is_chromeos_device) {
+      if (is_clang && !is_android && !is_chromeos_device && !is_bsd) {
         cflags += [ "--target=i386-unknown-linux-gnu" ]
         ldflags += [ "--target=i386-unknown-linux-gnu" ]
       } else {
@@ -1342,7 +1353,7 @@ config("compiler_cpu_abi") {
         "-msse3",
       ]
     } else if (current_cpu == "arm") {
-      if (is_clang && !is_android && !is_chromeos_device) {
+      if (is_clang && !is_android && !is_chromeos_device && !is_bsd) {
         cflags += [ "--target=arm-linux-gnueabihf" ]
         ldflags += [ "--target=arm-linux-gnueabihf" ]
       }
@@ -1354,7 +1365,7 @@ config("compiler_cpu_abi") {
         cflags += [ "-mtune=$arm_tune" ]
       }
     } else if (current_cpu == "arm64") {
-      if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) {
+      if (is_clang && !is_bsd && !is_android && !is_fuchsia && !is_chromeos_device) {
         cflags += [ "--target=aarch64-linux-gnu" ]
         ldflags += [ "--target=aarch64-linux-gnu" ]
       }
@@ -1707,7 +1718,7 @@ config("compiler_deterministic") {
       "-file-prefix-map",
       rebase_path("//.", "") + "=" + rebase_path("//.", root_build_dir),
     ]
-    if (!is_win) {
+    if (!is_win && !is_bsd) {
       # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
       asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
     }
@@ -1754,7 +1765,7 @@ config("compiler_deterministic") {
 
 config("clang_revision") {
   if (is_clang && clang_base_path == default_clang_base_path &&
-      current_os != "zos") {
+      current_os != "zos" && !is_bsd) {
     _perform_consistency_checks = current_toolchain == default_toolchain
     if (llvm_force_head_revision) {
       _head_revision_stamp_path = "//third_party/llvm-build/force_head_revision"
@@ -2525,7 +2536,7 @@ config("export_dynamic") {
 # 2. Remove the thin_archive config, so that the .a file actually contains all
 #    .o files, instead of just references to .o files in the build directoy
 config("thin_archive") {
-  if ((is_apple && use_lld) || (is_linux && !is_clang) || current_os == "aix") {
+  if ((is_apple && use_lld) || (is_linux && !is_clang && !is_bsd) || current_os == "aix") {
     # The macOS and iOS linker ld64.ldd doesn't support thin archive without
     # symbol table, gcc on linux also throws the error `archive has no index`.
     # AIX does support -s option, not -S option.
@@ -2961,7 +2972,7 @@ config("afdo_optimize_size") {
 # There are some targeted places that AFDO regresses, so we provide a separate
 # config to allow AFDO to be disabled per-target.
 config("afdo") {
-  if (is_clang) {
+  if (is_clang && !is_bsd) {
     cflags = []
     if (clang_emit_debug_info_for_profiling) {
       # Add the following flags to generate debug info for profiling.
@@ -2988,7 +2999,7 @@ config("afdo") {
       cflags += [ "-Wno-backend-plugin" ]
       inputs = [ _clang_sample_profile ]
     }
-  } else if (auto_profile_path != "" && is_a_target_toolchain) {
+  } else if (auto_profile_path != "" && is_a_target_toolchain && !is_bsd) {
     cflags = [ "-fauto-profile=${auto_profile_path}" ]
     inputs = [ auto_profile_path ]
   }
@@ -3097,7 +3108,7 @@ config("symbols") {
     }
 
     if (current_os != "zos") {
-      cflags += [ "-g2" ]
+      cflags += [ "-g0" ]
     }
 
     if (is_clang && !is_tsan && !is_asan) {
@@ -3135,7 +3146,7 @@ config("symbols") {
       ldflags += split_dwarf_flags
     }
 
-    _enable_gdb_index = symbol_level == 2 && !is_apple && use_lld && !is_wasm
+    _enable_gdb_index = symbol_level == 2 && !is_apple && !is_bsd && use_lld && !is_wasm
     if (_enable_gdb_index) {
       if (is_clang) {
         # This flag enables the GNU-format pubnames and pubtypes sections,
@@ -3168,7 +3179,7 @@ config("symbols") {
     cflags += [ "-gomit-unreferenced-methods" ]
   }
 
-  if (is_clang) {
+  if (is_clang && !is_bsd) {
     if (is_apple) {
       # TODO(crbug.com/40117949): Investigate missing debug info on mac.
       # Make sure we don't use constructor homing on mac.
