@@ -52,12 +52,13 @@ You can pretty much copy that output into your file. Start with a few modificati
52
52
- Fill ` llvm-target ` with [ the triple that LLVM expects] [ llvm-target-triple ]
53
53
- Decide on a panicking strategy. A bare metal implementation will likely use
54
54
` "panic-strategy": "abort" ` . If you decide not to ` abort ` on panicking, unless you [ tell Cargo
55
- to] [ eh_personality ] , you must define an [ eh_personality] function.
55
+ to] [ eh_personality ] per-project , you must define an [ eh_personality] function.
56
56
- Configure atomics. Pick the first option that describes your target:
57
57
- I have a single-core processor, no threads, [ ** no interrupts** ] [ interrupts-note ] , or any way for
58
58
multiple things to be happening in parallel: if you are ** sure** that is the case, such as WASM
59
59
(for now), you may set ` "singlethread": true ` . This will configure LLVM to convert all atomic
60
- operations to use their single threaded counterparts.
60
+ operations to use their single threaded counterparts. Incorrectly using this option may result
61
+ in UB if using threads or interrupts.
61
62
- I have native atomic operations: set ` max-atomic-width ` to the biggest type in bits that your
62
63
target can operate on atomically. For example, many ARM cores have 32-bit atomic operations. You
63
64
may set ` "max-atomic-width": 32 ` in that case.
@@ -66,7 +67,9 @@ You can pretty much copy that output into your file. Start with a few modificati
66
67
[ atomic] [ libcalls-atomic ] and [ sync] [ libcalls-atomic ] functions expected by LLVM as
67
68
` #[no_mangle] unsafe extern "C" ` . These functions have been standardized by gcc, so the [ gcc
68
69
documentation] [ gcc-sync ] may have more notes. Missing functions will cause a linker error, while
69
- incorrectly implemented functions will possibly cause UB.
70
+ incorrectly implemented functions will possibly cause UB. For example, if you have a
71
+ single-core, single-thread processor with interrupts, you can implement these functions to
72
+ disable interrupts, perform the regular operation, and then re-enable them.
70
73
- I have no native atomic operations: you'll have to do some unsafe work to manually ensure
71
74
synchronization in your code. You must set ` "max-atomic-width": 0 ` .
72
75
- Change the linker if integrating with an existing toolchain. For example, if you're using a
0 commit comments