$OpenBSD: patch-build_config_compiler_BUILD_gn,v 1.6 2017/12/22 08:21:56 robert Exp $

Index: build/config/compiler/BUILD.gn
--- build/config/compiler/BUILD.gn.orig
+++ build/config/compiler/BUILD.gn
@@ -46,7 +46,7 @@ declare_args() {
   # 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_openbsd) &&
       (current_cpu == "x64" || current_cpu == "x86")
   binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
                               root_build_dir)
@@ -231,7 +231,7 @@ config("compiler") {
     # Linker warnings.
     if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") &&
         !(is_android && use_order_profiling) && !is_mac && !is_ios &&
-        current_os != "aix") {
+        current_os != "aix" && !is_openbsd) {
       # 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
@@ -294,7 +294,7 @@ config("compiler") {
       }
     }
 
-    if (is_official_build) {
+    if (is_official_build && !is_openbsd) {
       # Explicitly pass --build-id to ld. Compilers used to always pass this
       # implicitly but don't any more (in particular clang when built without
       # ENABLE_LINKER_BUILD_ID=ON). The crash infrastructure does need a build
@@ -343,8 +343,6 @@ config("compiler") {
       "-Wl,-z,relro",
     ]
     if (!using_sanitizer) {
-      ldflags += [ "-Wl,-z,defs" ]
-
       # Functions interposed by the sanitizers can make ld think
       # that some libraries aren't needed when they actually are,
       # http://crbug.com/234010. As workaround, disable --as-needed.
@@ -474,7 +472,6 @@ config("compiler") {
     } else {
       cflags_cc += [ "-std=gnu++14" ]
     }
-    cflags_cc += [ "-fno-delete-null-pointer-checks" ]
   } else if (!is_win && !is_nacl) {
     if (target_os == "android") {
       cxx11_override = use_cxx11_on_android
@@ -1217,13 +1214,13 @@ config("default_warnings") {
         "-Wno-address-of-packed-member",
 
         # TODO(hans): https://crbug.com/681136
-        "-Wno-unused-lambda-capture",
+        # "-Wno-unused-lambda-capture",
 
         # TODO(thakis ): https://crbug.com/683349
         "-Wno-user-defined-warnings",
 
         # TODO(thakis): https://crbug.com/753973
-        "-Wno-enum-compare-switch",
+        # "-Wno-enum-compare-switch",
       ]
     } else if (use_xcode_clang && xcode_version_int >= 830) {
       # This is necessary to allow a progressive transition from using xcode 8.0
@@ -1794,7 +1791,7 @@ config("symbols") {
         # [1] crrev.com/a81d5ade0b043208e06ad71a38bcf9c348a1a52f
         cflags += [ "-gdwarf-3" ]
       }
-      cflags += [ "-g2" ]
+      cflags += [ "-g0" ]
     }
     if (use_debug_fission) {
       cflags += [ "-gsplit-dwarf" ]
