hl3mukkel
hl3mukkel

Reputation: 6049

What are the differences between the GNU and MSVC Rust toolchain?

The documentation states:

Which version of Rust you need depends largely on what C/C++ libraries you want to interoperate with: for interop with software produced by Visual Studio use the MSVC build of Rust; for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU build.

What exactly are those differences?

  1. Is it just about interoperability with the MSVC compiled binaries?

  2. Does it affect the linking or does Rust or LLVM provide their own linker?

  3. I know Rust uses LLVM as their backend, will choosing between the two affect code generation?

Upvotes: 34

Views: 9540

Answers (1)

Sebastian Redl
Sebastian Redl

Reputation: 72063

  1. Yes.
  2. It uses the linker of the specified toolchain. Rust does not provide its own linker.
  3. Yes, but only so far as ABI compatibility is concerned. It doesn't affect the optimizations, except possibly indirectly because different unwind mechanisms (libunwind for GNU, SEH for MSVC) are used.

Upvotes: 19

Related Questions