Won't build yasm with sanitizer option for release build.

In addition to debug build, let me disable the sanitizer for release
build.  To remove sanitizer option at link time,
//build/config/sanitizers:link_executable is added in BUILDCONFIG.gn
instead of build/config/BUILD.gn.

Bug: 887234
Change-Id: I5a13d0d6cc63b454f75cedc71870f157de80ad0c
Reviewed-on: https://chromium-review.googlesource.com/c/1264196
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#598688}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5292ab62d28d9a4235d07e5558e2cd1d5a601bbc
diff --git a/BUILD.gn b/BUILD.gn
index 35a85b1..e81ece7 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -29,7 +29,10 @@
 
 import("//build/config/compiler/compiler.gni")
 
-configs_to_delete = []
+configs_to_delete = [
+  # Don't enable sanitizers for build tools. They slow down the overall build.
+  "//build/config/sanitizers:default_sanitizer_flags",
+]
 configs_to_add = []
 if (is_debug) {
   configs_to_delete += [
@@ -41,9 +44,6 @@
 
     # Don't define _DEBUG. Modest savings, but good for consistency.
     "//build/config:debug",
-
-    # Don't enable sanitizers for build tools. They slow down the overall build.
-    "//build/config/sanitizers:default_sanitizer_flags",
   ]
 
   configs_to_add += [
@@ -117,7 +117,10 @@
       "source/patched-yasm/tools/genperf/perfect.c",
     ]
 
-    configs -= [ "//build/config/compiler:chromium_code" ]
+    configs -= [
+      "//build/config/compiler:chromium_code",
+      "//build/config/sanitizers:link_executable",
+    ]
     configs += [
       ":yasm_config",
       "//build/config/compiler:no_chromium_code",
@@ -326,7 +329,10 @@
       "$target_gen_dir/module.c",
     ]
 
-    configs -= [ "//build/config/compiler:chromium_code" ]
+    configs -= [
+      "//build/config/compiler:chromium_code",
+      "//build/config/sanitizers:link_executable",
+    ]
     configs += [
       ":yasm_config",
       "//build/config/compiler:no_chromium_code",