Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Unified Diff: build/config/sanitizers/BUILD.gn

Issue 1734043003: Add gn option 'is_lto' to enable Link Time Optimization builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/config/sanitizers/sanitizers.gni » ('j') | build/config/sanitizers/sanitizers.gni » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/sanitizers/BUILD.gn
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn
index 19af2ba8a522b06cfb563c112a1600d7560af936..0b596ba8f2456100365604a05b61acf97548cff0 100644
--- a/build/config/sanitizers/BUILD.gn
+++ b/build/config/sanitizers/BUILD.gn
@@ -92,13 +92,8 @@ config("default_sanitizer_ldflags") {
if (is_ubsan_vptr) {
ldflags += [ "-fsanitize=vptr" ]
}
- if (is_cfi && !is_nacl) {
- ldflags += [
- "-flto",
- "-fsanitize=cfi-vcall",
- "-fsanitize=cfi-derived-cast",
- "-fsanitize=cfi-unrelated-cast",
- ]
+ if (is_lto && !is_nacl) {
+ ldflags += [ "-flto" ]
# Apply a lower LTO optimization level as the default is too slow.
if (is_linux) {
@@ -119,6 +114,14 @@ config("default_sanitizer_ldflags") {
ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
}
+ if (is_cfi) {
+ ldflags += [
+ "-fsanitize=cfi-vcall",
+ "-fsanitize=cfi-derived-cast",
+ "-fsanitize=cfi-unrelated-cast",
+ ]
+ }
+
if (use_cfi_diag) {
ldflags += [
"-fno-sanitize-trap=cfi",
@@ -147,7 +150,7 @@ config("default_sanitizer_flags") {
if (is_posix) {
# Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer,
# MemorySanitizer and non-official CFI builds.
- if (using_sanitizer || (is_cfi && !is_official_build)) {
+ if (using_sanitizer || (is_lto && !is_official_build)) {
cflags += [
"-fno-omit-frame-pointer",
"-gline-tables-only",
@@ -243,16 +246,19 @@ config("default_sanitizer_flags") {
"-fsanitize-blacklist=$ubsan_vptr_blacklist_path",
]
}
- if (is_cfi && !is_nacl) {
- cfi_blacklist_path =
- rebase_path("//tools/cfi/blacklist.txt", root_build_dir)
- cflags += [
- "-flto",
- "-fsanitize=cfi-vcall",
- "-fsanitize=cfi-derived-cast",
- "-fsanitize=cfi-unrelated-cast",
- "-fsanitize-blacklist=$cfi_blacklist_path",
- ]
+ if (is_lto && !is_nacl) {
+ cflags += [ "-flto" ]
+
+ if (is_cfi) {
+ cfi_blacklist_path =
+ rebase_path("//tools/cfi/blacklist.txt", root_build_dir)
+ cflags += [
+ "-fsanitize=cfi-vcall",
+ "-fsanitize=cfi-derived-cast",
+ "-fsanitize=cfi-unrelated-cast",
+ "-fsanitize-blacklist=$cfi_blacklist_path",
+ ]
+ }
if (use_cfi_diag) {
cflags += [
« no previous file with comments | « no previous file | build/config/sanitizers/sanitizers.gni » ('j') | build/config/sanitizers/sanitizers.gni » ('J')

Powered by Google App Engine
This is Rietveld 408576698