Gcc `cmse_check_address_range`随着编译器升级而改变行为
我用的是Cortex-M33和手臂信任区。我的安全固件中有一个安全api,我可以从非安全固件调用它。所有工作如预期-至少在我将编译器从Gcc `cmse_check_address_range`随着编译器升级而改变行为,gcc,arm,cortex-m,trust-zone,Gcc,Arm,Cortex M,Trust Zone,我用的是Cortex-M33和手臂信任区。我的安全固件中有一个安全api,我可以从非安全固件调用它。所有工作如预期-至少在我将编译器从gcc-arm-none-eabi-7-2018-q2-update升级到gcc-arm-none-eabi-10-2020-q4-major之前 所讨论的函数如下所示: bool __attribute__((cmse_nonsecure_call)) (*Callback_Handler)(); __unused __attribute__((cmse_no
gcc-arm-none-eabi-7-2018-q2-update
升级到gcc-arm-none-eabi-10-2020-q4-major
之前
所讨论的函数如下所示:
bool __attribute__((cmse_nonsecure_call)) (*Callback_Handler)();
__unused __attribute__((cmse_nonsecure_entry))
bool Secure_SetSomeCallbackHandler(bool (*handler)()) {
// this cmse-check fails with the compiler in `version gcc-arm-none-eabi-10-2020-q4-major`
// it works with the `gcc-arm-none-eabi-7-2018-q2-update` though
handler = cmse_check_address_range(handler, 4, CMSE_NONSECURE);
if (handler == NULL) {
return false;
}
Callback_Handler = handler;
return true;
}
我使用cmse\u check\u address\u range
确保提供的指针确实位于非安全空间中。这适用于版本7,但如果我使用版本10编译代码,则返回NULL
。我没有更改源代码或任何其他部分中的任何内容,只更改了编译器
我检查了该函数中的任何更改,但甚至https://github.com/gcc-mirror/gcc/commits/master/libgcc/config/arm/cmse.c
不显示任何更改
有什么变化吗?也许我使用的函数不是预期的(我需要不同的函数标志吗?但是,同样,它适用于版本7)
更新:
- 我还在arm嵌入式工具链论坛上发布了以下内容:
- @许浩贴了一个错误
diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm
index 364f40ebe7f9..3625a2590bee 100644
--- a/libgcc/config/arm/t-arm
+++ b/libgcc/config/arm/t-arm
@@ -4,7 +4,7 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \
HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
HAVE_V81M:=$(findstring armv8.1-m.main,$(gcc_compile_bare))
-ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 2>/dev/null; echo $?),0)
+ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 2>/dev/null; echo $$?),0)
CMSE_OPTS:=-mcmse
endif
diff--git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm
索引364f40ebe7f9..3625a2590bee 100644
---a/libgcc/config/arm/t-arm
+++b/libgcc/config/arm/t-arm
@@-4,7+4,7@@LIB1ASMFUNCS=\u thumb1\u case\u sqi\u thumb1\u case\u qi\u thumb1\u case\u shi\
HAVE_CMSE:=$(findstring u ARM u FEATURE_CMSE,$(shell$(gcc_compile_bare)-dM-E-/dev/null;echo$?),0)
+ifeq($(shell$(gcc_compile_bare)-E-mcmse-/dev/null 2>/dev/null;echo$$?),0)
CMSE_选项:=-mcmse
恩迪夫
我已报告错误:您是否将为该函数生成的代码与两个编译器进行了比较?
gcc arm none eabi objdump--discomble=Secure_SetSomeCallbackHandler
应该可以工作。