Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 86249d733ca9de4fec5fabaf7ea232dc27e7d2e0..b335343a5b441c609d7ef8d97344b13d0d89883c 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -282,8 +282,23 @@ config("compiler") { |
"-Wl,-z,now", |
"-Wl,-z,relro", |
] |
- if (!using_sanitizer && !use_cfi_diag) { |
- ldflags += [ "-Wl,-z,defs" ] |
+ if (!using_sanitizer) { |
+ if (!use_cfi_diag) { |
+ 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. |
+ if (!is_nacl && !is_android) { |
+ # TODO(pcc): Fix linker bug which requires us to link pthread |
+ # unconditionally here (crbug.com/623236). |
+ ldflags += [ |
+ "-Wl,--no-as-needed", |
+ "-lpthread", |
+ ] |
+ } |
+ ldflags += [ "-Wl,--as-needed" ] |
} |
} |
@@ -1277,21 +1292,6 @@ if (is_win) { |
"-Wl,-O1", |
"-Wl,--gc-sections", |
] |
- |
- if (!using_sanitizer) { |
- # 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. |
- if (!is_nacl && !is_android) { |
- # TODO(pcc): Fix linker bug which requires us to link pthread |
- # unconditionally here (crbug.com/623236). |
- common_optimize_on_ldflags += [ |
- "-Wl,--no-as-needed", |
- "-lpthread", |
- ] |
- } |
- common_optimize_on_ldflags += [ "-Wl,--as-needed" ] |
- } |
} |
} |