--- build/config/compiler/BUILD.gn.orig 2017-04-19 21:06:28.000000000 +0200 +++ build/config/compiler/BUILD.gn 2017-06-15 22:15:26.426452000 +0200 @@ -36,7 +36,7 @@ # only two architectures that are currently checked in). Turn this off when # you are using a custom toolchain and need to control -B in cflags. linux_use_bundled_binutils = - linux_use_bundled_binutils_override && is_linux && + linux_use_bundled_binutils_override && (is_linux && !is_bsd) && (current_cpu == "x64" || current_cpu == "x86") binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", root_build_dir) @@ -158,7 +158,7 @@ configs += [ "//build/config/win:compiler" ] } else if (is_android) { configs += [ "//build/config/android:compiler" ] - } else if (is_linux) { + } else if (is_linux || is_bsd) { configs += [ "//build/config/linux:compiler" ] } else if (is_nacl) { configs += [ "//build/config/nacl:compiler" ] @@ -214,7 +214,7 @@ # Linker warnings. if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") && - !(is_android && use_order_profiling) && !is_mac && !is_ios) { + !(is_android && use_order_profiling) && !is_mac && !is_ios && !is_bsd) { # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 # crbug.com/485542 @@ -301,7 +301,7 @@ # Linux/Android common flags setup. # --------------------------------- - if (is_linux || is_android) { + if (is_linux || is_bsd || is_android) { cflags += [ "-fPIC", "-pipe", # Use pipes for communicating between sub-processes. Faster. @@ -314,7 +314,7 @@ "-Wl,-z,relro", ] if (!using_sanitizer) { - if (!use_cfi_diag) { + if (!use_cfi_diag && !is_bsd) { ldflags += [ "-Wl,-z,defs" ] } @@ -428,14 +428,14 @@ # clang-cl (used if is_win) doesn't expose this flag. # Currently disabled for nacl since its toolchain lacks this flag (too old). # TODO(zforman): Once nacl's toolchain is updated, remove check. - if (is_clang && is_linux && strip_absolute_paths_from_debug_symbols) { + if (is_clang && (is_linux || is_bsd) && strip_absolute_paths_from_debug_symbols) { absolute_path = rebase_path("//.") cflags += [ "-fdebug-prefix-map=$absolute_path=." ] } # C++11 compiler flags setup. # --------------------------- - if (is_linux || is_android || (is_nacl && is_clang)) { + if (is_linux || is_bsd || is_android || (is_nacl && is_clang)) { # gnu++11 instead of c++11 is needed because some code uses typeof() (a # GNU extension). # TODO(thakis): Eventually switch this to c++11 instead, @@ -488,7 +488,7 @@ ] # Apply a lower LTO optimization level as the default is too slow. - if (is_linux) { + if (is_linux || is_bsd) { if (use_lld) { ldflags += [ "-Wl,--lto-O1" ] } else { @@ -508,7 +508,7 @@ # targeting ARM, without this flag, LTO produces a .text section that is # larger than the maximum call displacement, preventing the linker from # relocating calls (http://llvm.org/PR22999). - if (is_linux) { + if (is_linux || is_bsd) { ldflags += [ "-Wl,-plugin-opt,-function-sections" ] } } @@ -776,7 +776,7 @@ # configs -= [ "//build/config/compiler:clang_stackrealign" ] # See https://crbug.com/556393 for details of where it must be avoided. config("clang_stackrealign") { - if (is_clang && current_cpu == "x86" && is_linux) { + if (is_clang && current_cpu == "x86" && (is_linux || is_bsd)) { cflags = [ # Align the stack on 16-byte boundaries, http://crbug.com/418554. "-mstack-alignment=16", @@ -830,7 +830,7 @@ # smaller. if (is_win) { configs += [ "//build/config/win:runtime_library" ] - } else if (is_linux) { + } else if (is_linux || is_bsd) { configs += [ "//build/config/linux:runtime_library" ] } else if (is_ios) { configs += [ "//build/config/ios:runtime_library" ] @@ -1104,7 +1104,7 @@ "-Wno-block-capture-autoreleasing", # TODO(hans): https://crbug.com/681136 - "-Wno-unused-lambda-capture", + # "-Wno-unused-lambda-capture", # TODO(thakis ): https://crbug.com/683349 "-Wno-user-defined-warnings", @@ -1144,7 +1144,7 @@ ] if (!is_debug && !using_sanitizer && - (!is_linux || !is_clang || is_official_build)) { + (!is_linux || !is_bsd || !is_clang || is_official_build)) { # _FORTIFY_SOURCE isn't really supported by Clang now, see # http://llvm.org/bugs/show_bug.cgi?id=16821. # It seems to work fine with Ubuntu 12 headers though, so use it in @@ -1203,7 +1203,7 @@ ] } - if (is_linux || is_android) { + if (is_linux || is_bsd || is_android) { cflags_cc += [ # Don't warn about hash_map in third-party code. "-Wno-deprecated", @@ -1647,7 +1647,7 @@ "-g2", ] } else { - cflags = [ "-g2" ] + cflags = [ "-g0" ] } if (use_debug_fission) { cflags += [ "-gsplit-dwarf" ]