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

[rules] Rename and change semantiv of extra_bazel_features #26068

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pamaury
Copy link
Contributor

@pamaury pamaury commented Jan 30, 2025

The extra_bazel_features attribute was added #25840 as an attribute to rv_rule to transitively add features to the rule. However this is too general because when applied to opentitan_binary, it will change the features not only for the rule, but all its dependencies such as exec_env, tools, etc which may have unintended effects.

This commit keeps essentially the same logic but instead of applying it to rv_rule, it is now only an attribute of opentitan_binary and opentitan_test and it transitions only features for the deps. This attribute is also renamed to transitive_features. The rationale for the rename is that every bazel rule has an implicit features argument but it only applies to the target, not its dependencies. This attribute does the same but also applies transitively.

@pamaury pamaury requested a review from cfrantz as a code owner January 30, 2025 12:42
@pamaury pamaury force-pushed the compiler_features_rework branch from 81d5f3c to 0a9a024 Compare January 30, 2025 15:05
rules/opentitan/cc.bzl Show resolved Hide resolved
Comment on lines 242 to 245
transitive_features = [
"minsize",
"use_lld",
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Any issue with just enabling these globally in the rv32imc toolchain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't tried yet, I will create a PR to try it. I don't think there is any harm in explicitely specifying it for important targets such as rom_ext.

@pamaury pamaury force-pushed the compiler_features_rework branch 2 times, most recently from 794a936 to 7b54615 Compare January 30, 2025 15:57
The `extra_bazel_features` attribute was added lowRISC#25840 as an attribute
to `rv_rule` to transitively add features to the rule. However this is
too general because when applied to opentitan_binary, it will change
the features not only for the rule, but all its dependencies such as
exec_env, tools,  etc which may have unintended effects.

This commit keeps essentially the same logic but instead of applying
it to `rv_rule`, it is now only an attribute of `opentitan_binary`
and `opentitan_test` and it transitions only features for the `deps`.
This attribute is also renamed to `transitive_features`. The rationale
for the rename is that every bazel rule has an implicit `features`
argument but it only applies to the target, not its dependencies. This
attribute does the same but also applies transitively.

Signed-off-by: Amaury Pouly <[email protected]>
@pamaury pamaury force-pushed the compiler_features_rework branch from 7b54615 to d7cd8a2 Compare January 30, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants