Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

rust

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?

like image 273
hl3mukkel Avatar asked Oct 25 '17 12:10

hl3mukkel


1 Answers

  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.
like image 50
Sebastian Redl Avatar answered Nov 11 '22 16:11

Sebastian Redl