generated from bazel-contrib/rules-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
Currently, tests, executables and shared libraries are linked using zig.
However, there are scenarios where it is useful to defer the link using the linker configured by rules_cc:
- it's not possible to override the linker using
zig build-*(-flldis lld only and is ignored on macos) - SPEED, on macos we go from 40s to 8s linking
- control, not all options are supported and some are even swallowed (zig cc silently ignores
-fuse-ld=option ziglang/zig#18357)
Proposed approach
Introduce a linkmode string_flag with 2 possible values ["zig" (default), "cc"] and use that in zig_build_impl to perform the linking accordingly.
When linkmode = "cc", we always produce a static library and use cc_common.link to perform the link, letting rules_cc deal with linker_inputs from transitive C deps.
When zig is used, nothing changes, zig is used to produce the final artifact and linker inputs of transitive C deps are collected and added to the compiler CLI arguments just like it is the case today.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels