-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wonder what rustc's command to call the linker looks like when it ends up #124734
Comments
@syejing We actually, for some target platforms, invoke a C compiler as our linker driver. Only for Windows and bare metal targets do we typically use the linker directly. |
OK, my operating system is mac os, in fact I tracked and found that I did use cc, my original intention was to see how to use rustc to convert .rs files to .ll llvm ir, use llc to convert .ll to .s assembly, and then use as to convert .s to .o machine code, and now stuck in how to use linker to turn .o into executable files. fn main() {
} |
|
Eh? Last I checked, we don't actually do those things. We convert the code to the data structure forms directly used by LLVM, in memory, mostly by invoking LLVM. Then we invoke LLVM on the data structures to finish compilation. We don't write .ll to disk if we can avoid doing so, and we definitely don't call |
Hmm, I can understand the true meaning, but I want to ask how to call the linker and what is command? |
I believe this is what you want: RUSTC_LOG=INFO rustc hello.rs 2>&1 | grep "link" |
这输出的结果和--print link-args一样 |
|
Adding -C save-temps solved the problem. Symbols.o, main.main.o, main.0 are saved, and cc is enough. Thank you. |
Hi,
clang can see the linker call command through -v, does rustc have a similar function, not --print link-args?
The text was updated successfully, but these errors were encountered: