Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[features] Fix minsize feature list order #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions features/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,11 @@ feature(
enabled = False,
flag_sets = [
flag_set(
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS + LD_ALL_ACTIONS,
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-Oz",
# Inline slightly more which is actually smaller.
"-mllvm", "--inline-threshold=10",
],
),
],
Expand Down Expand Up @@ -364,11 +362,15 @@ feature_set(
":exceptions",
":use_lld",
":lto",
":minsize",
":symbol_garbage_collection",
":dbg",
":fastbuild",
":opt",

# To overwrite the level to minsize with feature flags, it needs to be
# listed after the compilation modes.
":minsize",
Comment on lines +370 to +372
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the flag names in the feature definition (-mllvm), it seems this this may be an LLVM-only feature and this might be an error for GCC-based compilers.

I'd suggest adding this to the feature_set for toolchains where we know the compiler is LLVM. E.g., //platforms/riscv32/features:rv32imcb.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I moved the llvm flags to rv32 features.


":output_format",
":misc",
":coverage",
Expand Down
31 changes: 31 additions & 0 deletions platforms/riscv32/features/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,36 @@ feature(
provides = ["compilation_mode"],
)

feature(
name = "minsize",
enabled = False,
flag_sets = [
flag_set(
actions = C_ALL_COMPILE_ACTIONS + CPP_ALL_COMPILE_ACTIONS,
flag_groups = [
flag_group(
flags = [
"-Oz",
# Inline slightly more which is actually smaller.
"-mllvm", "--inline-threshold=10",
],
),
],
),
flag_set(
actions = LD_ALL_ACTIONS,
flag_groups = [
flag_group(
flags = [
# Inline slightly more which is actually smaller.
"-Wl,-mllvm", "-Wl,--inline-threshold=10",
],
),
],
),
],
)

feature(
name = "guards",
enabled = False,
Expand Down Expand Up @@ -168,6 +198,7 @@ feature_set(
":all_warnings_as_errors",
":fastbuild",
":opt",
":minsize",
":sys_spec",
":rv32_bitmanip",
],
Expand Down