File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11load ("@rules_rust//rust:defs.bzl" , "rust_binary" )
22load ("@semmle_code//buildutils-internal:glibc_symbols_check.bzl" , "glibc_symbols_check" )
33load ("@semmle_code//buildutils-internal:lipo.bzl" , "universal_binary" )
4+ load ("@semmle_code//buildutils-internal:transitions.bzl" , "forward_binary_from_transition" , "get_transition_attrs" )
5+
6+ def _full_lto_transition_impl (_settings , _attr ):
7+ return {"@rules_rust//rust/settings:lto" : "fat" }
8+
9+ _full_lto_transition = transition (
10+ implementation = _full_lto_transition_impl ,
11+ inputs = [],
12+ outputs = ["@rules_rust//rust/settings:lto" ],
13+ )
14+
15+ _full_lto_binary = rule (
16+ implementation = forward_binary_from_transition ,
17+ attrs = get_transition_attrs (_full_lto_transition ),
18+ )
419
520def codeql_rust_binary (
621 name ,
22+ full_lto = False ,
723 target_compatible_with = None ,
824 visibility = None ,
925 symbols_test = True ,
1026 ** kwargs ):
1127 rust_label_name = "single_arch/" + name
28+ binary_dep = ":" + rust_label_name
29+ if full_lto :
30+ lto_label_name = "full_lto/" + name
31+ _full_lto_binary (
32+ name = lto_label_name ,
33+ dep = binary_dep ,
34+ )
35+ binary_dep = ":" + lto_label_name
1236 universal_binary (
1337 name = name ,
14- dep = ":" + rust_label_name ,
38+ dep = binary_dep ,
1539 target_compatible_with = target_compatible_with ,
1640 visibility = visibility ,
1741 )
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ codeql_rust_binary(
1111 "src/qltest_cargo.mustache" ,
1212 "src/nightly-toolchain/rust-toolchain.toml" ,
1313 ],
14+ full_lto = True ,
1415 proc_macro_deps = all_crate_deps (
1516 proc_macro = True ,
1617 ) + [
You can’t perform that action at this time.
0 commit comments