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.
This commit is contained in:
Jozef Lawrynowicz 2020-05-08 14:45:20 +01:00
parent 89aa37dc3c
commit e8fb1a3892
6 changed files with 44 additions and 7 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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);
}

View File

@ -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)

View File

@ -1,3 +1,8 @@
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

View File

@ -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));