From 41d146597caea6d5cab6def07a8b127de7b2099c Mon Sep 17 00:00:00 2001 From: Ramana Radhakrishnan Date: Fri, 1 Apr 2016 14:58:53 +0000 Subject: [PATCH] re PR target/70496 (inadvertent change to ASM_APP_OFF for .arm / .thumb directives.) Fix PR target/70496 While doing the unified asm rewrite - I inadvertently changed the meaning of ASM_APP_OFF which causes failures when folks who know what they are doing switch between arm and thumb states within a function. The intent of the unified asm rewrite was not to affect any inline assembler code in that it would remain in divided syntax by default and switching back to unified asm in normal compiled code after the inline assembler block. Thanks to Jim Wilson for pointing it out on the linaro list. Fixed thusly and a test is added. Tested arm-none-eabi cross and applied. Ramana 2016-04-01 Ramana Radhakrishnan PR target/70496 * config/arm/arm.h (ASM_APP_OFF): Handle TARGET_ARM and TARGET_THUMB. 2016-04-01 Ramana Radhakrishnan PR target/70496 * gcc.target/arm/pr70496.c: New test. From-SVN: r234675 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.h | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/arm/pr70496.c | 12 ++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/arm/pr70496.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93db5c6..b0ac140 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-04-01 Ramana Radhakrishnan + + PR target/70496 + * config/arm/arm.h (ASM_APP_OFF): Handle TARGET_ARM + and TARGET_THUMB. + 2016-04-01 Nathan Sidwell * tree.def (TRY_CATCH_EXPR): Correct documentation. diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 6352140..ad123dd 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2037,7 +2037,8 @@ extern int making_const_table; "\t.syntax divided\n") #undef ASM_APP_OFF -#define ASM_APP_OFF "\t.syntax unified\n" +#define ASM_APP_OFF (TARGET_ARM ? "\t.arm\n\t.syntax unified\n" : \ + "\t.thumb\n\t.syntax unified\n") /* Output a push or a pop instruction (only used when profiling). We can't push STATIC_CHAIN_REGNUM (r12) directly with Thumb-1. We know diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 339821c..5393d8c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-04-01 Ramana Radhakrishnan + + PR target/70496 + * gcc.target/arm/pr70496.c: New test. + 2016-04-01 Nathan Sidwell PR c++/68475 diff --git a/gcc/testsuite/gcc.target/arm/pr70496.c b/gcc/testsuite/gcc.target/arm/pr70496.c new file mode 100644 index 0000000..89957e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr70496.c @@ -0,0 +1,12 @@ +/* { dg-do assemble } */ +/* { dg-options "-mthumb -O2" } */ +/* { dg-require-effective-target arm_thumb2_ok } */ + +int i; +void +main (void) +{ + __asm__ volatile (".arm"); + i = 0; + __asm__ volatile ("\n cbz r0, 2f\n2:"); +} -- 2.7.4