Skip to content

Commit e0d2fbe

Browse files
committed
[features] Fix minsize feature list order
Only the last optimization level is effective. To overwrite the level to minsize with the minsize feature flag, the feature needs to be listed after the compilation modes. Change-Id: I63ff18f0b6ae450441708e80abbf7228f031913f Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
1 parent 3eeb4b8 commit e0d2fbe

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

features/common/BUILD.bazel

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,11 @@ feature(
208208
enabled = False,
209209
flag_sets = [
210210
flag_set(
211-
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS + LD_ALL_ACTIONS,
211+
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS,
212212
flag_groups = [
213213
flag_group(
214214
flags = [
215215
"-Oz",
216-
# Inline slightly more which is actually smaller.
217-
"-mllvm", "--inline-threshold=10",
218216
],
219217
),
220218
],
@@ -364,11 +362,15 @@ feature_set(
364362
":exceptions",
365363
":use_lld",
366364
":lto",
367-
":minsize",
368365
":symbol_garbage_collection",
369366
":dbg",
370367
":fastbuild",
371368
":opt",
369+
370+
# To overwrite the level to minsize with feature flags, it needs to be
371+
# listed after the compilation modes.
372+
":minsize",
373+
372374
":output_format",
373375
":misc",
374376
":coverage",

platforms/riscv32/features/BUILD.bazel

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,36 @@ feature(
106106
provides = ["compilation_mode"],
107107
)
108108

109+
feature(
110+
name = "minsize",
111+
enabled = False,
112+
flag_sets = [
113+
flag_set(
114+
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS,
115+
flag_groups = [
116+
flag_group(
117+
flags = [
118+
"-Oz",
119+
# Inline slightly more which is actually smaller.
120+
"-mllvm", "--inline-threshold=10",
121+
],
122+
),
123+
],
124+
),
125+
flag_set(
126+
actions = LD_ALL_ACTIONS,
127+
flag_groups = [
128+
flag_group(
129+
flags = [
130+
# Inline slightly more which is actually smaller.
131+
"-Wl,-mllvm", "-Wl,--inline-threshold=10",
132+
],
133+
),
134+
],
135+
),
136+
],
137+
)
138+
109139
feature(
110140
name = "guards",
111141
enabled = False,
@@ -168,6 +198,7 @@ feature_set(
168198
":all_warnings_as_errors",
169199
":fastbuild",
170200
":opt",
201+
":minsize",
171202
":sys_spec",
172203
":rv32_bitmanip",
173204
],

0 commit comments

Comments
 (0)