From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2098) id 804673860C32; Fri, 18 Jun 2021 12:26:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 804673860C32 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: SRINATH PARVATHANENI To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-9935] arm: Fix the mve multilib for the broken cmse support (pr99939). X-Act-Checkin: gcc X-Git-Author: Srinath Parvathaneni X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: ec759162b317147a99a505ae4f34875dbc4308aa X-Git-Newrev: 0fd8e3ac9db8aed59db610b29d83a49b89a638c1 Message-Id: <20210618122650.804673860C32@sourceware.org> Date: Fri, 18 Jun 2021 12:26:50 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 12:26:50 -0000 https://gcc.gnu.org/g:0fd8e3ac9db8aed59db610b29d83a49b89a638c1 commit r10-9935-g0fd8e3ac9db8aed59db610b29d83a49b89a638c1 Author: Srinath Parvathaneni Date: Fri Jun 11 15:56:37 2021 +0100 arm: Fix the mve multilib for the broken cmse support (pr99939). The current CMSE support in the multilib build for "-march=armv8.1-m.main+mve -mfloat-abi=hard -mfpu=auto" is broken as specified in PR99939 and this patch fixes the issue. gcc/testsuite/ChangeLog: 2021-06-11 Srinath Parvathaneni PR target/99939 * gcc.target/arm/cmse/cmse-18.c: Add separate scan-assembler directives check for target is v8.1-m.main+mve or not before comparing the assembly output. * gcc.target/arm/cmse/cmse-20.c: New test. libgcc/ChangeLog: 2021-06-11 Srinath Parvathaneni PR target/99939 * config/arm/cmse_nonsecure_call.S: Add __ARM_FEATURE_MVE macro. * config/arm/t-arm: To link cmse.o and cmse_nonsecure_call.o on passing -mcmse option. (cherry picked from commit c5ed0148347beea1bd34795de146adddd2454c36) Diff: --- gcc/testsuite/gcc.target/arm/cmse/cmse-18.c | 3 ++- gcc/testsuite/gcc.target/arm/cmse/cmse-20.c | 28 ++++++++++++++++++++++++++++ libgcc/config/arm/cmse_nonsecure_call.S | 4 ++-- libgcc/config/arm/t-arm | 5 ++--- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c index e1ff09257b7..db7d975a90e 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c @@ -8,4 +8,5 @@ void bar(f func, int a) func(a); } -/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" } } */ +/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" { target { ! arm_v8_1m_mve_ok } } } } */ +/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r\[0-7\]:SI\\\]\\\]" "final" { target { arm_v8_1m_mve_ok } } } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c new file mode 100644 index 00000000000..08e89bff637 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c @@ -0,0 +1,28 @@ +/* This test is executed only if the execution engine supports CMSE instructions. */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ + +#include +#include +#include + +void __attribute__((cmse_nonsecure_entry)) +secure_fun (int a, int *p) +{ + void *b = cmse_check_address_range ((void *)p, a, 1); + + if (b == NULL) + __builtin_abort (); + printf("%d", *((int *)b)); +} + +int +main (void) +{ + int *ptr; + int size = 1; + ptr = (int *) calloc (1, sizeof(int *)); + *ptr = 1315852292; + secure_fun (size, ptr); + free (ptr); + return 0; +} diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S index 5ba28692d6b..b1954b8714d 100644 --- a/libgcc/config/arm/cmse_nonsecure_call.S +++ b/libgcc/config/arm/cmse_nonsecure_call.S @@ -25,7 +25,7 @@ .syntax unified #ifdef __ARM_PCS_VFP -# if __ARM_FP & 0x8 +# if (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1) .fpu fpv5-d16 # else .fpu fpv4-sp-d16 @@ -59,7 +59,7 @@ vmov s24, s25, r5, r5 vmov s26, s27, r5, r5 vmov s28, s29, r5, r5 vmov s30, s31, r5, r5 -#elif __ARM_FP & 0x08 +#elif (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1) vmov.f64 d9, d8 vmov.f64 d10, d8 vmov.f64 d11, d8 diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm index 3625a2590be..c1553d4e5d8 100644 --- a/libgcc/config/arm/t-arm +++ b/libgcc/config/arm/t-arm @@ -3,18 +3,17 @@ 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 2>/dev/null; echo $$?),0) CMSE_OPTS:=-mcmse endif ifdef HAVE_CMSE -ifndef HAVE_V81M + libgcc-objects += cmse.o cmse_nonsecure_call.o cmse.o: $(srcdir)/config/arm/cmse.c $(gcc_compile) -c $(CMSE_OPTS) $< + cmse_nonsecure_call.o: $(srcdir)/config/arm/cmse_nonsecure_call.S $(gcc_compile) -c $< endif -endif