Commit ea511c32 authored by thomasanderson's avatar thomasanderson Committed by Commit bot

Link with -Wl,--as-needed on non-optimized builds

BUG=620169
R=dpranke@chromium.org

Review-Url: https://codereview.chromium.org/2338373003
Cr-Commit-Position: refs/heads/master@{#418743}
parent e2173d0f
......@@ -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" ]
}
}
......@@ -1280,21 +1295,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" ]
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment