28

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?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
hl3mukkel
  • 5,369
  • 3
  • 21
  • 21

1 Answers1

16
  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.
Sebastian Redl
  • 69,373
  • 8
  • 123
  • 157
  • Are any of these two unwind mechanisms superiour or do they have different trade-offs? Thanks for the quick response btw! – hl3mukkel Oct 25 '17 at 12:54
  • 1
    @hl3mukkel were you able to find the difference between the two ABIs? If I'm cross-compiling a program for Windows, which target should I compile against? – Rakshith Ravi Jan 09 '20 at 10:45