Skip to content

Commit

Permalink
Fix typos with calculating flags for lto setting
Browse files Browse the repository at this point in the history
Default behavior was incorrect as the `unspecified` should have no-op
on the compile flags. However this was not the case due to incorrect
conditions.
  • Loading branch information
havasd committed Dec 17, 2024
1 parent 0e2fbbf commit c601618
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rust/private/lto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def construct_lto_arguments(ctx, toolchain, crate_info):
if mode in ["thin", "fat", "off"] and not is_exec_configuration(ctx):
args.append("lto={}".format(mode))

if format in ["unspecified", "object_and_bitcode"]:
if mode == "unspecified" or format == "object_and_bitcode":
# Embedding LLVM bitcode in object files is `rustc's` default.
args.extend([])
elif format in ["off", "only_object"]:
elif mode == "off" or format == "only_object":
args.extend(["embed-bitcode=no"])
elif format == "only_bitcode":
args.extend(["linker-plugin-lto"])
Expand Down
2 changes: 1 addition & 1 deletion test/unit/lto/lto_test_suite.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _lto_test_impl(ctx, lto_setting, embed_bitcode, linker_plugin):
return analysistest.end(env)

def _lto_level_default(ctx):
return _lto_test_impl(ctx, None, "no", False)
return _lto_test_impl(ctx, None, None, False)

_lto_level_default_test = analysistest.make(
_lto_level_default,
Expand Down

0 comments on commit c601618

Please sign in to comment.