Skip to content

Commit 3a7e27b

Browse files
committed
Rationalise the directive order for inline asm.
I went with: * .section * .arm or .thumb * .global * .type * label * code This fixes the smp_test built for thumb mode, which was missing a .arm directive (and the start-up code doesn't work in thumb mode).
1 parent 71bf032 commit 3a7e27b

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

aarch32-rt/src/arch_v4/abort.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ core::arch::global_asm!(
55
// Work around https://github.com/rust-lang/rust/issues/127269
66
.fpu vfp2
77
8-
.section .text._asm_default_data_abort_handler
98
109
// Called from the vector table when we have an undefined exception.
1110
// Saves state and calls a C-compatible handler like
1211
// `extern "C" fn _data_abort_handler(addr: usize);`
13-
.global _asm_default_data_abort_handler
12+
.section .text._asm_default_data_abort_handler
1413
.arm
14+
.global _asm_default_data_abort_handler
1515
.type _asm_default_data_abort_handler, %function
1616
_asm_default_data_abort_handler:
1717
// Subtract 8 from the stored LR, see p.1214 of the ARMv7-A architecture manual.
@@ -39,13 +39,13 @@ core::arch::global_asm!(
3939
movs pc, lr
4040
.size _asm_default_data_abort_handler, . - _asm_default_data_abort_handler
4141
42-
.section .text._asm_default_prefetch_abort_handler
4342
4443
// Called from the vector table when we have a prefetch abort.
4544
// Saves state and calls a C-compatible handler like
4645
// `extern "C" fn _prefetch_abort_handler(addr: usize);`
47-
.global _asm_default_prefetch_abort_handler
46+
.section .text._asm_default_prefetch_abort_handler
4847
.arm
48+
.global _asm_default_prefetch_abort_handler
4949
.type _asm_default_prefetch_abort_handler, %function
5050
_asm_default_prefetch_abort_handler:
5151
// Subtract 4 from the stored LR, see p.1212 of the ARMv7-A architecture manual.

aarch32-rt/src/arch_v4/interrupt.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ core::arch::global_asm!(
88
// Work around https://github.com/rust-lang/rust/issues/127269
99
.fpu vfp2
1010
11-
.section .text._asm_default_irq_handler
12-
1311
// Called from the vector table when we have an interrupt.
1412
// Saves state and calls a C-compatible handler like
1513
// `extern "C" fn _irq_handler();`
16-
.global _asm_default_irq_handler
14+
.section .text._asm_default_irq_handler
1715
.arm
16+
.global _asm_default_irq_handler
1817
.type _asm_default_irq_handler, %function
1918
_asm_default_irq_handler:
2019
// make sure we jump back to the right place

aarch32-rt/src/arch_v4/svc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ core::arch::global_asm!(
66
// Work around https://github.com/rust-lang/rust/issues/127269
77
.fpu vfp2
88
9-
.section .text._asm_default_svc_handler
109
1110
// Called from the vector table when we have an software interrupt.
1211
// Saves state and calls a C-compatible handler like
1312
// `extern "C" fn _svc_handler(svc: u32);`
14-
.global _asm_default_svc_handler
13+
.section .text._asm_default_svc_handler
1514
.arm
15+
.global _asm_default_svc_handler
1616
.type _asm_default_svc_handler, %function
1717
_asm_default_svc_handler:
1818
stmfd sp!, {{ r0, lr }}

aarch32-rt/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,8 @@ core::arch::global_asm!(
804804
805805
// Initialises stacks, .data and .bss
806806
.section .text._init_segments
807-
.global _init_segments
808807
.arm
808+
.global _init_segments
809809
.type _init_segments, %function
810810
_init_segments:
811811
// Initialise .bss

examples/mps3-an536/src/bin/smp_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ core::arch::global_asm!(
264264
//
265265
// Pass in stack top in r0.
266266
.section .text._stack_setup
267+
.arm
267268
.global _stack_setup
268269
.type _stack_setup, %function
269270
_stack_setup:

0 commit comments

Comments
 (0)