Skip to content

Commit a63989d

Browse files
sasdftimothytrippel
authored andcommitted
[features] Add feature for Oz minsize opt level
When enabling LTO, Oz is required to have a smaller firmware size. This PR adds the "minsize" feature, which will be enabled along with LTO on some ROM_EXT targets through bazel transition. In our tests with ROM_EXT on the master branch, * Os + LTO ~ +2,904 bytes * Oz - LTO ~ -1,260 bytes * Oz + LTO ~ -1,640 bytes Change-Id: I141284b331b9760fb25f690bba4c10b02057f13f Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
1 parent 8551be6 commit a63989d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

features/common/BUILD.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,25 @@ feature(
203203
],
204204
)
205205

206+
feature(
207+
name = "minsize",
208+
enabled = False,
209+
flag_sets = [
210+
flag_set(
211+
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS + LD_ALL_ACTIONS,
212+
flag_groups = [
213+
flag_group(
214+
flags = [
215+
"-Oz",
216+
# Inline slightly more which is actually smaller.
217+
"-mllvm", "--inline-threshold=10",
218+
],
219+
),
220+
],
221+
),
222+
],
223+
)
224+
206225
feature(
207226
name = "symbol_garbage_collection",
208227
enabled = True,
@@ -345,6 +364,7 @@ feature_set(
345364
":exceptions",
346365
":use_lld",
347366
":lto",
367+
":minsize",
348368
":symbol_garbage_collection",
349369
":dbg",
350370
":fastbuild",

0 commit comments

Comments
 (0)