--- cargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn.orig 2006-07-24 01:21:28 UTC +++ cargo-crates/v8-150.4.0/build/config/compiler/BUILD.gn @@ -203,7 +203,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 @@ -314,13 +314,16 @@ config("no_unresolved_symbols") { # 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_freebsd) { + ldflags = [ "-Wl,-z,notext", "-Wl,--strip-all" ] + } } # compiler --------------------------------------------------------------------- @@ -553,6 +556,10 @@ config("compiler") { } } + if (is_freebsd) { + ldflags += [ "-Wl,-z,wxneeded" ] + } + # Linux-specific compiler flags setup. # ------------------------------------ if (is_linux || is_chromeos) { @@ -588,9 +595,9 @@ config("compiler") { if (is_clang) { # Flags for diagnostics. cflags += [ "-fcolor-diagnostics" ] - if (!is_win) { + if (!is_win && !is_bsd) { cflags += [ "-fdiagnostics-show-inlining-chain" ] - } else { + } else if (is_win) { # Combine after https://github.com/llvm/llvm-project/pull/192241 cflags += [ "/clang:-fdiagnostics-show-inlining-chain" ] } @@ -615,7 +622,7 @@ config("compiler") { } } - if (is_clang) { + if (is_clang && !is_bsd) { cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ] if (save_reproducers_on_lld_crash && use_lld) { ldflags += [ @@ -731,6 +738,12 @@ config("compiler") { cflags_cc += [ "-Wno-trigraphs" ] } + if (is_bsd) { + # FreeBSD's linker rejects R_X86_64_TPOFF32 (local-exec TLS) relocations + # in shared libraries. Use local-dynamic TLS so libdenort.so can link. + defines += [ "V8_TLS_USED_IN_LIBRARY" ] + } + # Fuchsia enables this by default. if (use_relative_vtables_abi && !is_fuchsia) { cflags_cc += [ "-fexperimental-relative-c++-abi-vtables" ] @@ -1071,7 +1084,7 @@ config("linker") { # errors. We only apply fatal warnings when using lld. ldflags += [ "-Wl,-fatal_warnings" ] } - if (!is_apple && current_os != "aix" && current_os != "zos") { + if (!is_apple && !is_freebsd && current_os != "aix" && current_os != "zos") { ldflags += [ "-Wl,--fatal-warnings" ] } } @@ -1418,7 +1431,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,." ] } @@ -1471,7 +1484,7 @@ config("clang_revision") { 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" @@ -2748,7 +2761,7 @@ config("afdo") { # 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. @@ -2775,7 +2788,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 ] } @@ -2829,8 +2842,6 @@ config("split_dwarf") { ldflags = split_dwarf_flags } else { # .dwo files are generated when ThinLTO is not used. - c_additional_outputs = - [ "{{target_out_dir}}/{{label_name}}/{{source_name_part}}.dwo" ] } } @@ -2909,7 +2920,7 @@ config("symbols") { } if (current_os != "zos") { - cflags += [ "-g2" ] + cflags += [ "-g0" ] } if (is_clang && !is_tsan && !is_asan && !use_dwarf5) { @@ -2972,7 +2983,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.