windows - 为什么 Windows 上的 clang/llvm 需要 Visual Studio 的 Link.exe?

标签 windows linker llvm clang llc

根据 LLVM's Getting Started (Windows) site :

... Clang can be used to emit bitcode, directly emit object files or even linked executables using Visual Studio’s link.exe.

为什么需要在 Windows 上使用 Link.exe?而且,就此而言,在 Mac/Linux 上使用什么?再往下说:

Compile the program to object code using the LLC code generator:
    C:\..> llc -filetype=obj hello.bc
Link to binary using Microsoft link:
    C:\..> link hello.obj -defaultlib:libcmt

为什么 LLC 不能执行最后一步? LLI 似乎工作正常,所以我假设它在幕后以某种方式与 link.exe 互操作 - 为什么 LLC 不能?

最佳答案

因为没有人为 LLVM 编写过链接器。

有一个项目可以这样做(称为lld)但还没有准备好。

参见 http://lld.llvm.org了解更多详情。

在 mac 上,人们使用 Apple 的链接器,ld

在 Linux 上,大多数人使用 gnu 链接器,通常(也)命名为 ld

关于windows - 为什么 Windows 上的 clang/llvm 需要 Visual Studio 的 Link.exe?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14313439/

相关文章:

iOS 位码 - 安全问题

c++ - 如何获取LLVM全局变量常量值?

c - LLVM Pass 插入一个外部函数调用到 LLVM 位码

windows - Windows中如何在另一个进程启动时启动一个进程?

windows - 使用 hyper-v 与 virtualbox 的性能优势有多大?

c++ - 将静态库链接到其他静态库

ios - 模拟器中缺少来自 LayarSDK 的符号

windows - 如何授予帐户访问证书的权限?

windows - 以某种方式能够在 Windows 8 中启用 UAC 的情况下写入 ProgramData

c++ - 链接器,它们是复制目标代码还是只是引用它?