diff options
author | Jozef Lawrynowicz <jozef.l@somniumtech.com> | 2017-05-30 10:49:29 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2017-05-30 10:49:29 +0000 |
commit | b3125625df0b0895b0acbc2949d2a03dc4971145 (patch) | |
tree | 2343a92808c2b8228f1f25d64b9b63f388034431 /gcc/config/msp430 | |
parent | b2deed1233639aa49836571d2082dba0ddbd86b4 (diff) | |
download | gcc-b3125625df0b0895b0acbc2949d2a03dc4971145.zip gcc-b3125625df0b0895b0acbc2949d2a03dc4971145.tar.gz gcc-b3125625df0b0895b0acbc2949d2a03dc4971145.tar.bz2 |
re PR target/78838 (msp430 option -mcode-region=either, -ffunction-sections, and interrupt function attributes cause incorrect section to be created)
PR target/78838
gcc * config/msp430/msp430.c (gen_prefix): Return NULL when section name is
.lowtext.
(has_section_name): New function.
testsuite * gcc.target/msp430/interrupt_fn_placement.c: New test.
From-SVN: r248674
Diffstat (limited to 'gcc/config/msp430')
-rw-r--r-- | gcc/config/msp430/msp430.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 710a97b..dd53dea 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1818,6 +1818,15 @@ is_critical_func (tree decl = current_function_decl) return has_attr (ATTR_CRIT, decl); } +static bool +has_section_name (const char * name, tree decl = current_function_decl) +{ + if (decl == NULL_TREE) + return false; + return (DECL_SECTION_NAME (decl) + && (strcmp (name, DECL_SECTION_NAME (decl)) == 0)); +} + #undef TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS #define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS msp430_allocate_stack_slots_for_args @@ -2167,6 +2176,12 @@ gen_prefix (tree decl) if (has_attr ("section", decl)) return NULL; + /* If the function has been put in the .lowtext section (because it is an + interrupt handler, and the large memory model is used), then do not add + any prefixes. */ + if (has_section_name (".lowtext", decl)) + return NULL; + /* If the object has __attribute__((lower)) then use the ".lower." prefix. */ if (has_attr (ATTR_LOWER, decl)) return lower_prefix; |