[PATCH, GCC/ARM, 1/10] Fix -mcmse check in libgcc

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Mon Nov 4 16:44:00 GMT 2019


Hi Mihail,

On 10/23/19 10:26 AM, Mihail Ionescu wrote:
> [PATCH, GCC/ARM, 1/10] Fix -mcmse check in libgcc
>
> Hi,
>
> === Context ===
>
> This patch is part of a patch series to add support for Armv8.1-M
> Mainline Security Extensions architecture. Its purpose is to fix the
> check to determine whether -mcmse is supported by the host compiler.
>
> === Patch description ===
>
> Code to detect whether cmse.c can be buit with -mcmse checks the output
> of host GCC when invoked with -mcmse. However, an error from the
> compiler does not prevent some minimal output so this always holds true.
>
> This does not affect currently supported architectures since the test is
> guarded by __ARM_FEATURE_CMSE which is only defined for Armv8-M Baseline
> and Mainline and these two architectures accept -mcmse.
>
> However, in the intermediate patches adding support for Armv8.1-M
> Mainline, support for Security Extensions is disabled until fully
> implemented. This leads to libgcc/config/arm/cmse.c being built with
> -mcmse due to the broken test which fails in the intermediate commits.
>
> This patch instead change the test to look at the return value of the
> host gcc when invoked with -mcmse.
>
>
> ChangeLog entry is as follows:
>
> *** libgcc/ChangeLog ***
>
> 2019-10-23  Mihail-Calin Ionescu <mihail.ionescu@arm.com>
> 2019-10-23  Thomas Preud'homme <thomas.preudhomme@arm.com>
>
>         * config/arm/t-arm: Check return value of gcc rather than lack of
>         output.
>
> Testing: Bootstrapped and tested on arm-none-eabi.
> Without this patch, GCC stops building after the second patch
> of this series.
>
> Is this ok for trunk?
>
This looks ok to me and safe enough to go in on its own.

Thanks,

Kyrill


> Best regards,
>
> Mihail
>
>
> ###############     Attachment also inlined for ease of reply    
> ###############
>
>
> diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm
> index 
> 274bf2a8ef33c5e8a8ee2b246aba92d30297abe1..f2b927f3686a8c0a8e37abfe2d7768f2050d4fb3 
> 100644
> --- a/libgcc/config/arm/t-arm
> +++ b/libgcc/config/arm/t-arm
> @@ -3,7 +3,7 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi 
> _thumb1_case_shi \
>          _thumb1_case_uhi _thumb1_case_si _speculation_barrier
>
>  HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell 
> $(gcc_compile_bare) -dM -E - </dev/null))
> -ifneq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null 2>/dev/null),)
> +ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 
> 2>/dev/null; echo $?),0)
>  CMSE_OPTS:=-mcmse
>  endif
>
>



More information about the Gcc-patches mailing list