Skip to content

Commit be09d50

Browse files
gulfemsavruncopybara-github
authored andcommitted
[build] Balanced partitioning for section ordering
Enable the LLD option for ordering function sections using balanced partitioning to reduce the compressed binary size in Fuchsia. References: 1) RFC: https://discourse.llvm.org/t/rfc-extending-machos-balanced-partitioning-feature-to-elf/83157 2) PR: llvm/llvm-project#125559 3) Paper: https://arxiv.org/abs/2211.09285 4) Talk: https://www.youtube.com/watch?v=yd4pbSTjwuA&t=1157s Bug: 460885337 Change-Id: Id8302ed0a7fe1d5afdcff0e39cc0e7b2b5e95ef1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7164703 Reviewed-by: Zijie He <[email protected]> Auto-Submit: Gulfem Savrun Yeniceri <[email protected]> Reviewed-by: Hans Wennborg <[email protected]> Commit-Queue: Gulfem Savrun Yeniceri <[email protected]> Cr-Commit-Position: refs/heads/main@{#1548730} NOKEYCHECK=True GitOrigin-RevId: 900b0a15e5d0b41dbc1f9350d3b2f809260cbb36
1 parent d61ddee commit be09d50

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

config/compiler/BUILD.gn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,13 @@ config("compiler") {
614614
}
615615
}
616616

617+
# Fuchsia-specific compiler flags setup.
618+
# ------------------------------------
619+
if (is_fuchsia) {
620+
# Enable LLD's balanced partitioning for ordering function sections.
621+
ldflags += [ "-Wl,--bp-compression-sort=function" ]
622+
}
623+
617624
if (is_chromeos_device && current_toolchain == default_toolchain) {
618625
# Flags added automatically by ChromeOS's custom toolchain that are
619626
# not already added elsewhere in the configuration. Add these here,

0 commit comments

Comments
 (0)