Uh oh!
There was an error while loading. Please reload this page.
std: Move pc-windows-gnu to SEH-based unwinding - #31313
Conversation
alexcrichton
commented
Jan 30, 2016
rust-highfive
commented
Jan 30, 2016
(rust_highfive has picked a reviewer for you, use r? to override) |
821c985 to
4fa32eeComparenagisa
commented
Jan 31, 2016
すてき |
retep998
commented
Jan 31, 2016
Windows back traces being bad have very little to do with how unwinding is done, but rather with debug info. Symbol names are only preserved in the debug info and Windows is incapable of reading dwarf debug info and I highly doubt mingw is capable of emitting PDB/codeview debug info. If we want |
bors
commented
Jan 31, 2016
☔ The latest upstream changes (presumably #31298) made this pull request unmergeable. Please resolve the merge conflicts. |
alexcrichton
commented
Jan 31, 2016
hanna-kruppe
commented
Jan 31, 2016
I only got working backtraces two weeks ago (#30908) 😭 If possible, please don't land this before it works (i.e., gives decent backtraces) on gnu. Unfortunately, that may not be possible. AFAIK #31319 won't help gnu since CodeView debuginfo is (again AFAIK) useless without an MSVC edit: see Clang documentation |
alexcrichton
commented
Feb 1, 2016
@rkruppe yeah I was hoping to leave in libbacktrace for GNU for now, but it unfortunately would still require using MinGW's support for unwinding the stack (e.g.
I am curious what others think though! My personal priorities may be a bit backwards relative to others' :) |
retep998
commented
Feb 1, 2016
This is correct. We already rely on Windows to walk the stack to get a backtrace for If we did transition the |
alexcrichton
commented
Feb 1, 2016
If we did end up fully transitioning to only MSVC compilers we'd probably consider dropping support for the GNU ones yeah, but I should emphasize that these are just thoughts in my head and would certainly be very far out. Not necessarily any consensus on this strategy among anyone but me! |
hanna-kruppe
commented
Feb 1, 2016
To be frank I'm not attached to mingw, it's just what I've always been using to develop. I'm currently trying to build from source w/ MSVC and if that works, I will instantly stop caring about the |
nagisa
commented
Feb 1, 2016
MSVC is 10GB for link.exe. Its pain to install that instead of MinGW if you only need (to debug, in my case) Windows rustc, as opposed to MSVC Rust :) |
alexcrichton
commented
Feb 1, 2016
Sorry I don't mean to sidetrack discussion here, I don't think this is an appropriate location to discuss switching between |
retep998
commented
Feb 1, 2016
I believe the point is that there will still be compilers that target |
vadimcn
commented
Feb 1, 2016
Let's have a place then, so we can have a discussion before we start rolling in this direction. Should this be in the RFCs repo? |
retep998
commented
Feb 1, 2016
Nobody is suggesting to deprecate |
bors
commented
Feb 1, 2016
☔ The latest upstream changes (presumably #30367) made this pull request unmergeable. Please resolve the merge conflicts. |
brson
commented
Feb 2, 2016
This looks like a good consolidation. I'm inclined to break stack traces again for it unless it's possible to rig up something to read the dwarf symbol info in short order. |
alexcrichton
commented
Feb 2, 2016
I checked briefly and there's no way to at least configure libbacktrace to only have symbol-demangling support, so I suspect there's nothing too too easy we could do to get a dwarf reader. In theory it's not too hard to write though... |
petrochenkov
commented
Feb 2, 2016
After the fix in #30908 libbacktrace still doesn't work properly with PE/COFF. It does show function names instead of |
vadimcn
commented
Feb 2, 2016
Finally found the time to go through this PR. Impressive work! A note regarding rsbegin, rsend and LSDA parser: I wrote this code thinking that eventually we'd use them for Unix-y targets as well,- to reduce reliance on the GCC runtime. Is this something we'd want to do? |
bors
commented
Feb 8, 2016
☔ The latest upstream changes (presumably #31470) made this pull request unmergeable. Please resolve the merge conflicts. |
brson
commented
Feb 8, 2016
@bors r+ |
bors
commented
Feb 8, 2016
📌 Commit 3299609 has been approved by |
bors
commented
Feb 8, 2016
⌛ Testing commit 3299609 with merge 31377ef... |
bors
commented
Feb 8, 2016
💔 Test failed - auto-win-gnu-32-opt |
alexcrichton
commented
Feb 8, 2016
@bors: r=brson b2a53fe1a5f226d2cc88688bb4ddf07170591a9b |
bors
commented
Feb 9, 2016
⌛ Testing commit b2a53fe with merge 6b784f3... |
bors
commented
Feb 9, 2016
💔 Test failed - auto-win-gnu-32-nopt-t |
alexcrichton
commented
Feb 9, 2016
@bors: r=brson 7c7ecb4 |
This commit moves the `*-pc-windows-gnu` targets (e.g. the MinGW targets) to use SEH-based unwinding instead of libunwind-based unwinding. There are a number of ramifications on these targets as a result: * Binary distributions of the standard library are no longer tied to a particular compiler toolchain. The MinGW toolchains typically ship with either SEH, Dwarf, or SjLj based unwinding and are binary-incompatible, but with SEH unwinding we'll be able to link with any of the toolchains. * The GNU implementation is now much closer to the MSVC implementation, reducing the amount of duplicated code we'll have to maintain (yay!). * Due to the loss of the libunwind stack unwinder the libbacktrace library is no longer used on Windows. The same unwinding code for MSVC is now used for GNU as well, and unfortunately this has empirically led to worse stack traces in the past. In theory, though, this should be fixed for both MSVC and GNU at the same time! * Due to the lack of a need for frame unwind info registration, the `rsend.o` and `rsbegin.o` startup object files are no longer built. Additionally the `crt2.o` and `dllcrt2.o` files are no longer distributed. It's assumed that the linker in use will inject these as usual. The `-nostdlib` flag is no longer passed to the linker to indicate this. This change also opened up the possibility to reorganize a few modules, so the following changes were also made: * The `custom_unwind_resume` option and all support code was removed from trans as this is no longer necessary. * The `sys_common::unwind` module was refactored to have the platform-specific portions live in `sys::unwind`. * A similar refactoring was applied to backtrace writing (just shuffling some files around). * Documentation was updated in shuffled modules to reflect the current state of affairs.
retep998
commented
Feb 9, 2016
You appear to have r+'d the wrong commit |
nagisa
commented
Feb 9, 2016
@bors r=brson |
bors
commented
Feb 9, 2016
📌 Commit 0487292 has been approved by |
bors
commented
Feb 9, 2016
🔒 Merge conflict |
bors
commented
Feb 9, 2016
☔ The latest upstream changes (presumably #31282) made this pull request unmergeable. Please resolve the merge conflicts. |
| /// This is only true for MSVC targets, and even then the 64-bit MSVC target | ||
| /// currently uses SEH-ish unwinding with DWARF info tables to the side (same as | ||
| /// 64-bit MinGW) instead of "full SEH". | ||
| /// This is currentlyt true for all Windows targets. |
alexcrichton
commented
Feb 9, 2016
Well it appears I was a little too eager to land this, and I didn't thoroughly test it enough locally before doing so. My testing was all on It turns out that if LLVM has assertions enabled, they specifically have a check against this which means that we can't actually use funclets (the new exception handling things) on Basically it looks like this just isn't supported at this time for Alas! |
alexcrichton
commented
Feb 9, 2016
Note that my threshold for "this doesn't work" is:
targettriple = "i686-pc-windows-gnu"definevoid@bar() {
retvoid
}
definevoid@main() personalityi32 (...)* @_except_handler3 {
entry-block:
invokevoid@bar()
tolabel%exitunwindlabel%bad
exit:
retvoid
bad:
%pad = cleanuppad within none []
cleanupret from %padunwindto caller
}
declarei32@_except_handler3(...)
Note that the MSVC |
tamird
commented
Feb 9, 2016
Is there an upstream issue? Should there be? |
alexcrichton
commented
Feb 9, 2016
In theory, yes. I chatted briefly in |
This commit moves the
*-pc-windows-gnutargets (e.g. the MinGW targets) touse SEH-based unwinding instead of libunwind-based unwinding. There are a number
of ramifications on these targets as a result:
particular compiler toolchain. The MinGW toolchains typically ship with either
SEH, Dwarf, or SjLj based unwinding and are binary-incompatible, but with SEH
unwinding we'll be able to link with any of the toolchains.
the amount of duplicated code we'll have to maintain (yay!).
longer used on Windows. The same unwinding code for MSVC is now used for GNU
as well, and unfortunately this has empirically led to worse stack traces in
the past. In theory, though, this should be fixed for both MSVC and GNU at the
same time!
rsend.oand
rsbegin.ostartup object files are no longer built. Additionally thecrt2.oanddllcrt2.ofiles are no longer distributed. It's assumed thatthe linker in use will inject these as usual. The
-nostdlibflag is nolonger passed to the linker to indicate this.
This change also opened up the possibility to reorganize a few modules, so the
following changes were also made:
custom_unwind_resumeoption and all support code was removed from transas this is no longer necessary.
sys_common::unwindmodule was refactored to have the platform-specificportions live in
sys::unwind.files around).
affairs.