rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Support alwayslink for linking with clang?

Open keith opened this issue 3 years ago • 0 comments

When linking rust libraries into a final C/C++ binary, sometimes you may need a library to be force loaded in order to include symbols that may otherwise not be referenced, for example if you're interfacing with the JNI. This can be controlled in bazel by passing alwayslink = True/False to cc_common.create_library_to_link. Should the rules expose a alwayslink attribute, similar to cc_library and others, to control this? I'm happy to submit this if so. I'm not sure how this interacts with https://github.com/bazelbuild/rules_rust/issues/637 and https://github.com/bazelbuild/rules_rust/issues/1268 since they mostly seem to focus on binaries being linked with rustc, and not clang

keith avatar Apr 19 '22 17:04 keith