GNU 和 MSVC Rust 工具链之间有什么区别? [英] What are the differences between the GNU and MSVC Rust toolchain?

查看:343
本文介绍了GNU 和 MSVC Rust 工具链之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档说明:

您需要哪个版本的 Rust 在很大程度上取决于您想要与之互操作的 C/C++ 库:对于与 Visual Studio 生成的软件的互操作,请使用 Rust 的 MSVC 版本;要与使用 MinGW/MSYS2 工具链构建的 GNU 软件进行互操作,请使用 GNU 构建.

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.

这些区别究竟是什么?

  1. 这仅仅是与 MSVC 编译的二进制文件的互操作性吗?

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

它会影响链接还是 Rust 或 LLVM 提供自己的链接器?

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

我知道 Rust 使用 LLVM 作为后端,在两者之间进行选择会影响代码生成吗?

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

推荐答案

  1. 是的.
  2. 它使用指定工具链的链接器.Rust 不提供自己的链接器.
  3. 是的,但仅限于 ABI 兼容性.它不会影响优化,除非可能间接因为使用了不同的展开机制(用于 GNU 的 libunwind,用于 MSVC 的 SEH).

这篇关于GNU 和 MSVC Rust 工具链之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆