what options to pass to gcc for support of arm security extensions

Richard Earnshaw Richard.Earnshaw@foss.arm.com
Fri Jul 31 14:01:00 GMT 2015

My apologies, my statement this morning was not quite accurate.

SMC is only implemented as part of the security extensions feature.  As
such it is not part of the base-line ARMv7-A architecture.

To enable this feature you need to specify -march=armv7-a+sec (provided
your toolchain supports that).  You should also be able to enable it if
you build with -march=armv7ve (which includes SEC by default), or if you
take the -march= statement out of the list of options below and rely on
picking up the architecture from the -mcpu statement (your current
command line options are slightly in conflict, since Cortex-A15
implements the ARMv7VE version of the architecture).

Note that SMC will be treated as undefined if executed from user mode;
user code cannot call directly into the monitor.  But that's a different

Once again, apologies for misleading you earlier.


On 31/07/15 14:10, Shahin Ansari wrote:
> Thanks. The following are the flags I am using; I do not see what I am doing
> wrong. Would  you have a look? 
> LOCAL_CFLAGS := -march=armv7-a -mtune=cortex-a15 -D__ASSEMBLY__
> -mabi=aapcs-linux -gdwarf-2 -Wall -Wundef -Wstrict-proto
> types -Wno-trigraphs -fno-strict-aliasing -fno-common
> -Werror-implicit-function-declaration -Wno-format-security -fno-de
> lete-null-pointer-checks -Os -Wno-maybe-uninitialized -marm
> -fno-dwarf2-cfi-asm -fstack-protector -mabi=aapcs-linux -mno
> -thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-a15
> -msoft-float -Uarm -Wframe-larger-than=1024 -Wn
> o-unused-but-set-variable -fomit-frame-pointer -g
> -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -
> fconserve-stack -DCC_HAVE_ASM_GOTO
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
> Behalf Of Richard Earnshaw
> Sent: Friday, July 31, 2015 5:46 AM
> To: Shahin Ansari <shansari@verizon.net>; gcc-help@gcc.gnu.org
> Subject: Re: what options to pass to gcc for support of arm security
> extensions
> On 30/07/15 20:29, Shahin Ansari wrote:
>> Greetings-
>> According to the ARM documentation the SMC call should be supported at 
>> ARMv6 and above. However, I get the error message below when I try to use
> it:
> Almost, it's ARMv6Z that introduced the SMC instruction.  It will certainly
> be recognized for ARMv7-a and above.
> GCC uses the -mcpu= (or if that's not specified the -march=) options from
> the command line to tell the assembler what instructions should be
> permitted.
> R.

More information about the Gcc-help mailing list