@@ -4878,15 +4878,16 @@ proc check_effective_target_arm_cmse_ok {} {
proc check_effective_target_arm_cmse_hw { } {
return [check_runtime arm_cmse_hw_available {
- int __attribute__ ((cmse_nonsecure_entry)) ns_func(void)
- {
- return 0;
- }
int main (void)
{
- return ns_func();
- }
- } "-mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000"]
+ unsigned id_pfr1;
+ asm ("ldr\t%0, =0xe000ed44\n" \
+ "ldr\t%0, [%0]\n" \
+ "sg" : "=l" (id_pfr1));
+ /* Exit with code 0 iff security extension is available. */
+ return !(id_pfr1 & 0xf0);
+ }
+ } "-mcmse"]
}
# Return 1 if the target supports executing MVE instructions, 0
# otherwise.