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

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

Issue 2338373003: Link with -Wl,--as-needed on non-optimized builds (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" ]
- }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698