diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-05-08 14:45:20 +0100 |
---|---|---|
committer | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-05-12 12:54:16 +0100 |
commit | e8fb1a3892f4e2f8268ac2649776a7bd0a967643 (patch) | |
tree | 7306c846aa2caa3596b210957704db3c370714ea /gcc | |
parent | 89aa37dc3c71666d0ff05e96ea84e195d049a226 (diff) | |
download | gcc-e8fb1a3892f4e2f8268ac2649776a7bd0a967643.zip gcc-e8fb1a3892f4e2f8268ac2649776a7bd0a967643.tar.gz gcc-e8fb1a3892f4e2f8268ac2649776a7bd0a967643.tar.bz2 |
MSP430: Define ASM_OUTPUT_ALIGNED_DECL_LOCAL
gcc/ChangeLog:
2020-05-12 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/msp430/msp430-protos.h (msp430_output_aligned_decl_common):
Update prototype to include "local" argument.
* config/msp430/msp430.c (msp430_output_aligned_decl_common): Add
"local" argument. Handle local common decls.
* config/msp430/msp430.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Adjust
msp430_output_aligned_decl_common call with 0 for "local" argument.
(ASM_OUTPUT_ALIGNED_DECL_LOCAL): Define.
gcc/testsuite/ChangeLog:
2020-05-12 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* gcc.c-torture/execute/noinit-attribute.c: Skip for msp430
in the large memory model.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/msp430/msp430-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/msp430/msp430.c | 19 | ||||
-rw-r--r-- | gcc/config/msp430/msp430.h | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/noinit-attribute.c | 6 |
6 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b0a9212..e2b01aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2020-05-12 Jozef Lawrynowicz <jozef.l@mittosystems.com> + + * config/msp430/msp430-protos.h (msp430_output_aligned_decl_common): + Update prototype to include "local" argument. + * config/msp430/msp430.c (msp430_output_aligned_decl_common): Add + "local" argument. Handle local common decls. + * config/msp430/msp430.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Adjust + msp430_output_aligned_decl_common call with 0 for "local" argument. + (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Define. + 2020-05-12 Richard Biener <rguenther@suse.de> * cfghooks.c (split_edge): Preserve EDGE_DFS_BACK if set. diff --git a/gcc/config/msp430/msp430-protos.h b/gcc/config/msp430/msp430-protos.h index 657af4c..29ce9bab 100644 --- a/gcc/config/msp430/msp430-protos.h +++ b/gcc/config/msp430/msp430-protos.h @@ -39,7 +39,8 @@ bool msp430_is_interrupt_func (void); const char * msp430x_logical_shift_right (rtx); const char * msp430_mcu_name (void); void msp430_output_aligned_decl_common (FILE *, const tree, const char *, - unsigned HOST_WIDE_INT, unsigned); + unsigned HOST_WIDE_INT, unsigned, + int); void msp430_output_labelref (FILE *, const char *); void msp430_register_pragmas (void); rtx msp430_return_addr_rtx (int); diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index e77ca10..6bb1714 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -2019,13 +2019,15 @@ msp430_unique_section (tree decl, int reloc) /* Emit a declaration of a common symbol. If a data region is in use then put the symbol into the - equivalent .bss section instead. */ + equivalent .bss section instead. + If LOCAL is 1, then DECL is for a local common variable. */ void msp430_output_aligned_decl_common (FILE * stream, const tree decl, const char * name, unsigned HOST_WIDE_INT size, - unsigned int align) + unsigned int align, + int local) { /* Only emit a common symbol if the variable does not have a specific section assigned. */ @@ -2039,6 +2041,12 @@ msp430_output_aligned_decl_common (FILE * stream, && !has_attr (ATTR_PERSIST, decl) && !has_attr (ATTR_NOINIT, decl)) { + if (local) + { + fprintf (stream, LOCAL_ASM_OP); + assemble_name (stream, name); + fprintf (stream, "\n"); + } fprintf (stream, COMMON_ASM_OP); assemble_name (stream, name); fprintf (stream, "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", @@ -2069,8 +2077,11 @@ msp430_output_aligned_decl_common (FILE * stream, switch_to_section (sec); ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT)); - targetm.asm_out.globalize_label (stream, name); - ASM_WEAKEN_LABEL (stream, name); + if (!local) + { + targetm.asm_out.globalize_label (stream, name); + ASM_WEAKEN_LABEL (stream, name); + } ASM_OUTPUT_LABEL (stream, name); ASM_OUTPUT_SKIP (stream, size ? size : 1); } diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h index 1042c59..f198981 100644 --- a/gcc/config/msp430/msp430.h +++ b/gcc/config/msp430/msp430.h @@ -517,7 +517,13 @@ void msp430_register_pre_includes (const char *sysroot ATTRIBUTE_UNUSED, #undef USE_SELECT_SECTION_FOR_FUNCTIONS #define USE_SELECT_SECTION_FOR_FUNCTIONS 1 +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ - msp430_output_aligned_decl_common ((FILE), (DECL), (NAME), (SIZE), (ALIGN)) + msp430_output_aligned_decl_common ((FILE), (DECL), (NAME), (SIZE), (ALIGN), 0) + +#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL +#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ + msp430_output_aligned_decl_common ((FILE), (DECL), (NAME), (SIZE), (ALIGN), 1) + #define SYMBOL_FLAG_LOW_MEM (SYMBOL_FLAG_MACH_DEP << 0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index da77641..b83e0ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2020-05-12 Jozef Lawrynowicz <jozef.l@mittosystems.com> + * gcc.c-torture/execute/noinit-attribute.c: Skip for msp430 + in the large memory model. + +2020-05-12 Jozef Lawrynowicz <jozef.l@mittosystems.com> + * gcc.target/msp430/region-attribute-misuse.c: Allow a .bss section to be created. diff --git a/gcc/testsuite/gcc.c-torture/execute/noinit-attribute.c b/gcc/testsuite/gcc.c-torture/execute/noinit-attribute.c index b99417c..20a2a45 100644 --- a/gcc/testsuite/gcc.c-torture/execute/noinit-attribute.c +++ b/gcc/testsuite/gcc.c-torture/execute/noinit-attribute.c @@ -1,8 +1,12 @@ /* { dg-do run } */ /* { dg-require-effective-target noinit } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "data LMA != VMA" { msp430-*-* } { "-mlarge" } } */ -/* This test checks that noinit data is handled correctly. */ +/* This test checks that noinit data is handled correctly. + If data LMA != VMA (e.g. for simulating the copy of data from ROM to RAM), + then var_init will always be re-initialized to 2 and this test will loop + forever. */ extern void _start (void) __attribute__ ((noreturn)); extern void abort (void) __attribute__ ((noreturn)); |