-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Description
I am using nightly compiler.
It worked well until a point, and now started generating code that GPFs.
The project and branch for testing this is here: https://github.com/metta-systems/vesper/tree/investigate/invalid-code-gen
In the rust-toolchain
file I have found the exact version which breaks: nightly-2022-08-12 works, while nightly-2022-08-13 started generating something incorrectly.
I have looked though the generated machine code in the ELF binary and it seems to be exactly the same.
You can test yourself by running just qemu
with one or another version of nightly.
NB: UPDATED the code below seems to be misleading, there's other stuff breaking before that, see my comments below.
With 08-13 this happens:
----------------
IN:
0x00092a38: f9400268 ldr x8, [x19]
0x00092a3c: a94227e0 ldp x0, x9, [sp, #0x20]
0x00092a40: 8b141108 add x8, x8, x20, lsl #4
0x00092a44: a9400901 ldp x1, x2, [x8]
0x00092a48: f9400d28 ldr x8, [x9, #0x18]
0x00092a4c: d63f0100 blr x8 ; this is a virtual call in function Console::replace_with()
Taking exception 3 [Prefetch Abort] on CPU 0
...from EL1 to EL1
...with ESR 0x21/0x86000000
...with FAR 0x9599000000000
...with ELR 0x9599000000000
...to EL1 PC 0x96200 PSTATE 0x3c5
----------------
The console resides in the BSS section, as it is fully zero-initialised at the start. Since I was working on BSS initialization for my OS I at first suspected something is wrong with my code, so I replaced it with a simple plain-asm version: see this commit, however, the behavior persisted and triggered a search for exact rustc version that breaks.
Version compiled with 08-12 works well with both versions of BSS init code (inline rust that calls to memset and an asm version), see this commit.
Generated code to compare should be in target/nucleus.bin
Version it worked on
nightly-2022-08-12
Version with regression
Broke on nightly-2022-08-13 and remains so.