Skip to content
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

Remove C++ dependencies #11103

Closed
wants to merge 2 commits into from
Closed

Remove C++ dependencies #11103

wants to merge 2 commits into from

Conversation

vadimcn
Copy link
Contributor

@vadimcn vadimcn commented Dec 21, 2013

This PR removes Rust's dependency on C++ for exception handling. Instead, it will use the unwind library API directly.
LLVM still depends on libstdc++, but these bits can be linked into librustc statically, so we no longer need to redistribute libstdc++-6.dll on Windows.

closes #10469

@brson
Copy link
Contributor

brson commented Dec 22, 2013

Bravo. This is a holiday miracle.

@vadimcn
Copy link
Contributor Author

vadimcn commented Dec 22, 2013

Don't we need to distribute stdc++ with the snapshot since we're distributing llvm?

std++ will be statically linked into librustc along with LLVM, so no.

@alexcrichton
Copy link
Member

This truly is a christmas miracle, amazing work!

Is there a reason that this also doesn't drop all the libstdc++ linkage rules in std/rtdeps.rs? It'd be nice to have cfg(stage0) on them so we're sure that libstdc++ is completely purged.

@vadimcn
Copy link
Contributor Author

vadimcn commented Dec 22, 2013

Is there a reason that this also doesn't drop all the libstdc++ linkage rules in std/rtdeps.rs? It'd be nice to have cfg(stage0) on them so we're sure that libstdc++ is completely purged.

'cause I haven't stumbled upon it yet... Why do we need cfg(stage0) there?

Btw, shouldn't pthread be dropped too?

@alexcrichton
Copy link
Member

Hm, I just assume that it would need stage0, but if it gets past stage0 without a problem then it's fine by me. I know that stage0-generated code will be looking for a function called upcall_rust_personality, so that stuff may need some special defines for stage0. Basically as long as stage1+ don't depend on libstdc++ I'm happy.

You shouldn't drop pthread unless it's only for windows, all unixes still need pthread.

exception_class: _Unwind_Exception_Class,
ue_header: *_Unwind_Exception,
context: *_Unwind_Context) -> _Unwind_Reason_Code;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need __gcc_personality_seh0 or __gcc_personality_sjlj0 if one wants to build rust on mingw-w64 with seh/sjlj support. Maybe we can add others with #[cfg(...)] flags and set v0 (win32) and seh0 (win64) as default.

@klutzy
Copy link
Contributor

klutzy commented Dec 22, 2013

Seems that rt/rust_upcall.c should also be removed. (It causes "undefined reference to __gxx_personality_v0" on my machine)
Anyway, this is truly great! 💃 💃

@klutzy
Copy link
Contributor

klutzy commented Dec 22, 2013

It seems that my build failure was due to incompleteness of make clean. (#11114)

@pcwalton
Copy link
Contributor

What's really exciting about this to me is that having bindings to libunwind should allow us to make a working backtrace function on all platforms, eliminating all of the places where we hardcode file and line number information.

@vadimcn
Copy link
Contributor Author

vadimcn commented Dec 22, 2013

Created new PR #11121

@vadimcn vadimcn closed this Dec 22, 2013
@vadimcn vadimcn deleted the no-c++ branch December 28, 2013 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust should have an optional dependency on C++
5 participants