Description
When using the x86-interrupt calling convention for an exception with error code, the error code is wrong in debug mode. I checked the assembly code and it seems like it loads the first field of the exception stack frame instead of the error code, i.e. it is off by 8 bytes, so this seems to be a bug in LLVM. The interesting thing is that the error code is correct in release mode.
It worked correctly with nightly (9389e23a8 2017-12-31)
, so it is a regression. I'm currently trying different Rust versions to find out when the problem was introduced:
Nightly | Works? |
---|---|
(9389e23 2017-12-31) | Yes |
(8ccab7e 2018-01-31) | Yes |
(bd98fe0 2018-02-06) | Yes |
(3bcda48 2018-02-09) | Yes |
(45fba43 2018-02-10) | No |
(b8398d9 2018-02-11) | No |
(4d2d3fc 2018-02-13) | No |
(0ff9872 2018-02-28) | No |
(1ffb321 2018-05-31) | No |
(f4a421e 2018-12-13) | No |
Edit: The problem was introduced between the 2018-02-09 and the 2018-02-10 nightly. These are the relevant commits: 3bcda48...45fba43. I think it was most likely the upgrade to LLVM 6 in #47828, which was huge.
See phil-opp/blog_os#513 for more context.