File tree 4 files changed +123
-4
lines changed
src/doc/unstable-book/src
4 files changed +123
-4
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,38 @@ The tracking issue for this feature is: [#38487]
5
5
[ #38487 ] : https://github.com/rust-lang/rust/issues/38487
6
6
7
7
------------------------
8
+
9
+ In the MSP430 architecture, interrupt handlers have a special calling
10
+ convention. You can use the ` "msp430-interrupt" ` ABI to make the compiler apply
11
+ the right calling convention to the interrupt handlers you define.
12
+
13
+ <!-- NOTE(ignore) this example is specific to the msp430 target -->
14
+
15
+ ``` rust,ignore
16
+ #![feature(abi_msp430_interrupt)]
17
+ #![no_std]
18
+
19
+ // Place the interrupt handler at the appropriate memory address
20
+ // (Alternatively, you can use `#[used]` and remove `pub` and `#[no_mangle]`)
21
+ #[link_section = "__interrupt_vector_10"]
22
+ #[no_mangle]
23
+ pub static TIM0_VECTOR: extern "msp430-interrupt" fn() = tim0;
24
+
25
+ // The interrupt handler
26
+ extern "msp430-interrupt" fn tim0() {
27
+ // ..
28
+ }
29
+ ```
30
+
31
+ ``` text
32
+ $ msp430-elf-objdump -CD ./target/msp430/release/app
33
+ Disassembly of section __interrupt_vector_10:
34
+
35
+ 0000fff2 <TIM0_VECTOR>:
36
+ fff2: 00 c0 interrupt service routine at 0xc000
37
+
38
+ Disassembly of section .text:
39
+
40
+ 0000c000 <int::tim0>:
41
+ c000: 00 13 reti
42
+ ```
Original file line number Diff line number Diff line change 1
1
# ` abi_ptx `
2
2
3
- The tracking issue for this feature is: None.
3
+ The tracking issue for this feature is: [ #38788 ]
4
+
5
+ [ #38788 ] : https://github.com/rust-lang/rust/issues/38788
4
6
5
7
------------------------
8
+
9
+ When emitting PTX code, all vanilla Rust functions (` fn ` ) get translated to
10
+ "device" functions. These functions are * not* callable from the host via the
11
+ CUDA API so a crate with only device functions is not too useful!
12
+
13
+ OTOH, "global" functions * can* be called by the host; you can think of them
14
+ as the real public API of your crate. To produce a global function use the
15
+ ` "ptx-kernel" ` ABI.
16
+
17
+ <!-- NOTE(ignore) this example is specific to the nvptx targets -->
18
+
19
+ ``` rust,ignore
20
+ #![feature(abi_ptx)]
21
+ #![no_std]
22
+
23
+ pub unsafe extern "ptx-kernel" fn global_function() {
24
+ device_function();
25
+ }
26
+
27
+ pub fn device_function() {
28
+ // ..
29
+ }
30
+ ```
31
+
32
+ ``` text
33
+ $ xargo rustc --target nvptx64-nvidia-cuda --release -- --emit=asm
34
+
35
+ $ cat $(find -name '*.s')
36
+ //
37
+ // Generated by LLVM NVPTX Back-End
38
+ //
39
+
40
+ .version 3.2
41
+ .target sm_20
42
+ .address_size 64
43
+
44
+ // .globl _ZN6kernel15global_function17h46111ebe6516b382E
45
+
46
+ .visible .entry _ZN6kernel15global_function17h46111ebe6516b382E()
47
+ {
48
+
49
+
50
+ ret;
51
+ }
52
+
53
+ // .globl _ZN6kernel15device_function17hd6a0e4993bbf3f78E
54
+ .visible .func _ZN6kernel15device_function17hd6a0e4993bbf3f78E()
55
+ {
56
+
57
+
58
+ ret;
59
+ }
60
+ ```
Original file line number Diff line number Diff line change 1
1
# ` compiler_builtins_lib `
2
2
3
- This feature is internal to the Rust compiler and is not intended for general use .
3
+ The tracking issue for this feature is: None .
4
4
5
5
------------------------
6
+
7
+ This feature is required to link to the ` compiler_builtins ` crate which contains
8
+ "compiler intrinsics". Compiler intrinsics are software implementations of basic
9
+ operations like multiplication of ` u64 ` s. These intrinsics are only required on
10
+ platforms where these operations don't directly map to a hardware instruction.
11
+
12
+ You should never need to explicitly link to the ` compiler_builtins ` crate when
13
+ building "std" programs as ` compiler_builtins ` is already in the dependency
14
+ graph of ` std ` . But you may need it when building ` no_std ` ** binary** crates. If
15
+ you get a * linker* error like:
16
+
17
+ ``` text
18
+ $PWD/src/main.rs:11: undefined reference to `__aeabi_lmul'
19
+ $PWD/src/main.rs:11: undefined reference to `__aeabi_uldivmod'
20
+ ```
21
+
22
+ That means that you need to link to this crate.
23
+
24
+ When you link to this crate, make sure it only appears once in your crate
25
+ dependency graph. Also, it doesn't matter where in the dependency graph, you
26
+ place the ` compiler_builtins ` crate.
27
+
28
+ <!-- NOTE(ignore) doctests don't support `no_std` binaries -->
29
+
30
+ ``` rust,ignore
31
+ #![feature(compiler_builtins_lib)]
32
+ #![no_std]
33
+
34
+ extern crate compiler_builtins;
35
+ ```
Original file line number Diff line number Diff line change 1
1
# ` compiler_builtins `
2
2
3
- The tracking issue for this feature is: None .
3
+ This feature is internal to the Rust compiler and is not intended for general use .
4
4
5
5
------------------------
6
-
You can’t perform that action at this time.
0 commit comments