What are the differences between the GNU and MSVC

2019-02-16 14:17发布

问题:

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?

回答1:

  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.


标签: rust