File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ intrinsics ! {
2
+ pub unsafe extern "C" fn abort( ) -> ! {
3
+ // On AVRs, an architecture that doesn't support traps, unreachable code
4
+ // paths get lowered into calls to `abort`:
5
+ //
6
+ // https://github.com/llvm/llvm-project/blob/cbe8f3ad7621e402b050e768f400ff0d19c3aedd/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4462
7
+ //
8
+ // When control gets here, it means that either core::intrinsics::abort()
9
+ // was called or an undefined bebavior has occurred, so there's not that
10
+ // much we can do to recover - we can't `panic!()`, because for all we
11
+ // know the environment is gone now, so panicking might end up with us
12
+ // getting back to this very function.
13
+ //
14
+ // So let's do the next best thing, loop.
15
+ //
16
+ // Alternatively we could (try to) restart the program, but since
17
+ // undefined behavior is undefined, there's really no obligation for us
18
+ // to do anything here - for all we care, we could just set the chip on
19
+ // fire; but that'd be bad for the environment.
20
+
21
+ loop { }
22
+ }
23
+ }
Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ pub mod aarch64_linux;
63
63
) ) ]
64
64
pub mod arm_linux;
65
65
66
+ #[ cfg( target_arch = "avr" ) ]
67
+ pub mod avr;
68
+
66
69
#[ cfg( target_arch = "hexagon" ) ]
67
70
pub mod hexagon;
68
71
You can’t perform that action at this time.
0 commit comments