-
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
compiler-rt #12027
compiler-rt #12027
Conversation
Why should we bundle one more library into Rust even on platforms that already have libgcc or compiler-rt as built-in? How about adding a |
We prefer having a knowledge of all dependencies that we're bringing in, and we prefer even more about having control over building them (as long as we can fairly easily build them). The By bundling compiler-rt, we can both have a better understanding of what our dependencies are, plus we are going to be able to correctly lower all valid LLVM IR to something that we can compile. |
This is an amazing effort, thank you for doing this! Some thoughts:
|
So you mean we should just throw I'll try to upstream my changes to compiler-rt as soon as I figure out the procedure for doing this. Can't use -nodefaultlibs just yet, because we still need stack unwinding functions from libgcc. Well, we could try using the system unwind library, where available, or libgcc_eh. But I still don't know what to do about Windows, as stack unwind info registration depends on having libgcc_s_dw2.dll in the process. |
@vadimcn: I think each shared object is intended to have a copy of it. They're tiny support functions and I doubt they're used much on x86. |
@thestinger: maybe, but currently this is not the case - they are all imported from shared libgcc (unless one forces static linking). |
@vadimcn, I added some I, too, thought this was just a static library which provided small shims that LLVM lowers to. Is it not recommended to link |
@vadimcn: The compiler-rt library has one tiny support function per object file so any unused functions are not included. It would be interesting to see how many of these functions are actually used on x86_64. I don't think there are many. They're only called by the target's code generation when it can't do anything better. |
Is it feasible to make compiler-rt a crate? |
@brson: It could probably be wrapped as a crate, but no one should ever be using it directly. It exists solely for LLVM CodeGen to use as a last resort when there's no platform capability to do the operation. For example, integer division on platforms without CPU integer division. I don't think it has any sort of backwards compatibility guarantee. |
@vadimcn, would you like me to take over from here? Also, do you have an update on upstreaming the compiler-rt patches? |
I've submitted my patches to llvm-commits, but it hadn't made quite the splash I had hoped for [1]. I was about to ping them again. [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-February/thread.html#70117 |
@alexcrichton: added your makefile changes |
@@ -1130,6 +1131,18 @@ fn link_args(sess: Session, | |||
args.push(~"-shared-libgcc"); | |||
} | |||
|
|||
if sess.targ_cfg.os == abi::OsAndroid { | |||
// Enable multiple symbol definitions,- to be consistent with other platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here explaining about why this is needed in conjuction with comiler-rt
?
Could you also add alexcrichton@b37700c to this PR to see whether it can land with it? |
I can't test your -nodefaultlibs PR because I don't have a mac. I expect that my PR will cause breakage on its' own on platforms I didn't test, so I am thinking they will be easier to land separately. |
OK, I'll try to land it later. |
updated |
This is an attempt to remove some more of Rust's dependencies on libgcc and replace it with LLVM's compiler-rt lib. I've added compiler-rt as a submodule and changed libstd to link with it. As far as I could verify, after this change, the only symbols still imported by std from libgcc are the stack unwinding functions. Other crates, however, still picked up symbols from libgcc, not from libstd, as I had hoped. So linking definitely requires some work. I've only tested this on windows, 32-bit linux and android and fully expect it to fail on other platforms. Patches are welcome.
Wow, that was surprisingly painless, nice job! |
Congrats. |
Whoa, I'll be damned! |
This was just waiting for compiler-rt support, which was added in rust-lang#12027 Closes rust-lang#8449
…tate, r=Veykril fix: Try not to invalidate state when the proc macro preference didn't change This appears to fix rust-lang#12027, but I'm not sure.
This is an attempt to remove some more of Rust's dependencies on libgcc and replace it with LLVM's compiler-rt lib. I've added compiler-rt as a submodule and changed libstd to link with it.
As far as I could verify, after this change, the only symbols still imported by std from libgcc are the stack unwinding functions. Other crates, however, still picked up symbols from libgcc, not from libstd, as I had hoped. So linking definitely requires some work.
I've only tested this on windows, 32-bit linux and android and fully expect it to fail on other platforms. Patches are welcome.