Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Feedback when using with rustc/bazel/rules_rust #27

Open
bgeron opened this issue Mar 16, 2023 · 2 comments
Open

Feedback when using with rustc/bazel/rules_rust #27

bgeron opened this issue Mar 16, 2023 · 2 comments

Comments

@bgeron
Copy link

bgeron commented Mar 16, 2023

Hi,

Just wanted to give some feedback. I'm evaluating sold for rustc/bazel/rules_rust, but I cannot find a working way to use it.

  • If I specify -C linker=ld64.mold (via --@rules_rust//:extra_rustc_flag=), then rustc generates linker argument -m64 which mold does not understand.
  • If I specify -C linker=mold, then rustc additionally generates -arch x86_64 which mold does not understand.
  • I played around with various values of -C linker-flavor, but none seem to generate better args for mold. In particular, the lld flavors don't work because rustc will specify -flavor.
  • By default, rustc adds -dead_strip or -Wl,-dead_strip, which would be nice to retain.

Rustc when invoked with cargo seems to work fine somehow. I don't know if the differences are in Bazel or in our project configuration, which is quite elaborate because we're cross-compiling for ios.

Cheers, Bram

@rui314
Copy link
Contributor

rui314 commented Mar 17, 2023

The linker should be invoked indirectly by the compiler, so the linker should be the default (which is cc or c++).

Does passing -C link-arg=-fuse-ld=/path/to/ld64.sold work?

@bgeron
Copy link
Author

bgeron commented Mar 17, 2023

That seems to work, thanks! I don't even have to disable dead code stripping any more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants