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

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

Issue 2840723003: build: Enable function sections and data sections during LTO. (Closed)
Patch Set: Created 3 years, 8 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 6a495cc2a82b8b2500a5c7c0c5398b7389c8f0a3..092991d12fd13afbc88f722b4d17d9f4f1285006 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -512,12 +512,22 @@ config("compiler") {
ldflags += [ "-Wl,-all_load" ]
}
- # Allows the linker to apply ICF to the LTO object file. Also, when
- # targeting ARM, without this flag, LTO produces a .text section that is
- # larger than the maximum call displacement, preventing the linker from
- # relocating calls (http://llvm.org/PR22999).
+ # Allows the linker to apply --gc-sections and ICF to the LTO object file.
+ # Also, when targeting ARM, without this flag, LTO produces a .text section
+ # that is larger than the maximum call displacement, preventing the linker
+ # from relocating calls (http://llvm.org/PR22999).
if (is_linux) {
- ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
+ if (use_lld) {
+ ldflags += [
+ "-Wl,-mllvm,-function-sections",
+ "-Wl,-mllvm,-data-sections",
+ ]
+ } else {
+ ldflags += [
+ "-Wl,-plugin-opt,-function-sections",
+ "-Wl,-plugin-opt,-data-sections",
+ ]
+ }
}
}
« 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