mirror of
https://git.freebsd.org/ports.git
synced 2025-07-06 20:09:14 -04:00
Approved by: rene (mentor) Security: https://vuxml.freebsd.org/freebsd/310ca30e-a951-11ed-8314-a8a1599412c6.html
131 lines
5 KiB
Text
131 lines
5 KiB
Text
--- build/config/compiler/BUILD.gn.orig 2023-02-08 09:03:45 UTC
|
|
+++ build/config/compiler/BUILD.gn
|
|
@@ -224,13 +224,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" ]
|
|
+ }
|
|
}
|
|
|
|
# compiler ---------------------------------------------------------------------
|
|
@@ -454,6 +457,10 @@ config("compiler") {
|
|
}
|
|
}
|
|
|
|
+ if (is_openbsd) {
|
|
+ ldflags += [ "-Wl,-z,wxneeded" ]
|
|
+ }
|
|
+
|
|
# Linux-specific compiler flags setup.
|
|
# ------------------------------------
|
|
if (use_gold) {
|
|
@@ -529,7 +536,7 @@ config("compiler") {
|
|
ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
|
|
}
|
|
|
|
- if (is_clang && !is_nacl && current_os != "zos") {
|
|
+ if (is_clang && !is_nacl && current_os != "zos" && !is_bsd) {
|
|
cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
|
|
if (save_reproducers_on_lld_crash && use_lld) {
|
|
ldflags += [
|
|
@@ -813,7 +820,7 @@ config("compiler") {
|
|
# lldb doesn't have the needed changes yet.
|
|
# * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
|
|
# TODO(crbug.com/1379070): Remove if the upstream default ever changes.
|
|
- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
|
|
+ if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia && !is_bsd) {
|
|
cflags_cc += [ "-gsimple-template-names" ]
|
|
}
|
|
|
|
@@ -973,7 +980,7 @@ config("compiler_cpu_abi") {
|
|
]
|
|
}
|
|
} else if (current_cpu == "arm") {
|
|
- if (is_clang && !is_android && !is_nacl &&
|
|
+ if (is_clang && !is_android && !is_nacl && !is_bsd &&
|
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
|
cflags += [ "--target=arm-linux-gnueabihf" ]
|
|
ldflags += [ "--target=arm-linux-gnueabihf" ]
|
|
@@ -988,7 +995,7 @@ config("compiler_cpu_abi") {
|
|
cflags += [ "-mtune=$arm_tune" ]
|
|
}
|
|
} else if (current_cpu == "arm64") {
|
|
- if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
|
|
+ if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd &&
|
|
!(is_chromeos_lacros && is_chromeos_device)) {
|
|
cflags += [ "--target=aarch64-linux-gnu" ]
|
|
ldflags += [ "--target=aarch64-linux-gnu" ]
|
|
@@ -1322,7 +1329,7 @@ config("compiler_deterministic") {
|
|
# different build directory like "out/feature_a" and "out/feature_b" if
|
|
# we build same files with same compile flag.
|
|
# Other paths are already given in relative, no need to normalize them.
|
|
- if (is_nacl) {
|
|
+ if (is_nacl || is_bsd) {
|
|
# TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
|
|
cflags += [
|
|
"-Xclang",
|
|
@@ -1374,7 +1381,7 @@ config("compiler_deterministic") {
|
|
}
|
|
|
|
config("clang_revision") {
|
|
- if (is_clang && clang_base_path == default_clang_base_path) {
|
|
+ if (is_clang && !is_bsd && clang_base_path == default_clang_base_path) {
|
|
update_args = [
|
|
"--print-revision",
|
|
"--verify-version=$clang_version",
|
|
@@ -1615,7 +1622,7 @@ config("default_warnings") {
|
|
"-Wno-ignored-pragma-optimize",
|
|
]
|
|
|
|
- if (!is_nacl) {
|
|
+ if (!is_nacl && !is_bsd) {
|
|
cflags += [
|
|
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
|
"-Wno-deprecated-builtins",
|
|
@@ -1794,7 +1801,7 @@ config("no_chromium_code") {
|
|
# third-party libraries.
|
|
"-Wno-c++11-narrowing",
|
|
]
|
|
- if (!is_nacl) {
|
|
+ if (!is_nacl && !is_freebsd) {
|
|
cflags += [
|
|
# Disabled for similar reasons as -Wunused-variable.
|
|
"-Wno-unused-but-set-variable",
|
|
@@ -2302,7 +2309,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.
|
|
@@ -2318,7 +2325,7 @@ config("afdo") {
|
|
cflags += [ "-fprofile-sample-use=${rebased_clang_sample_profile}" ]
|
|
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 ]
|
|
}
|
|
@@ -2472,7 +2479,8 @@ config("symbols") {
|
|
configs += [ "//build/config:compress_debug_sections" ]
|
|
}
|
|
|
|
- if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos") {
|
|
+ if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "zos" &&
|
|
+ !is_bsd) {
|
|
if (is_apple) {
|
|
# TODO(https://crbug.com/1050118): Investigate missing debug info on mac.
|
|
# Make sure we don't use constructor homing on mac.
|