From bc3484e7930adb48c4a096c39d5bf2de50b1cdf2 Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Tue, 22 Mar 2022 23:51:24 +0100 Subject: [PATCH] Mark __aeabi_lmul section as allocatable and executable (#722) When using a linker script which does not provide a .time_critical. section that is marked "ax" and wrongly define PICO_INT64_OPS_IN_RAM=1 this would generate a malformed executable with strange runtime bugs in the worst case. --- src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S b/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S index 0dbc67c..114a1aa 100644 --- a/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S +++ b/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S @@ -10,11 +10,16 @@ #include "pico/asm_helper.S" +.macro int64_section name #if PICO_INT64_OPS_IN_RAM -.section RAM_SECTION_NAME(__aeabi_lmul) +.section RAM_SECTION_NAME(\name), "ax" #else -.section SECTION_NAME(__aeabi_lmul) +.section SECTION_NAME(\name), "ax" #endif +.endm + +int64_section __aeabi_lmul + wrapper_func __aeabi_lmul muls r1, r2 muls r3, r0 @@ -41,4 +46,3 @@ wrapper_func __aeabi_lmul adcs r1, r2 add r1, r12 bx lr -