From b47cae3dee210a9b985e18e2b6211ea8ce9c5d88 Mon Sep 17 00:00:00 2001 From: Marek Michalkiewicz Date: Sat, 25 May 2002 20:18:53 +0200 Subject: [PATCH] avr.c (avr_handle_progmem_attribute): Handle TYPE_DECL. * config/avr/avr.c (avr_handle_progmem_attribute): Handle TYPE_DECL. * config/avr/avr.h (BSS_SECTION_ASM_OP, ASM_OUTPUT_BSS): New. From-SVN: r53872 --- gcc/ChangeLog | 6 ++++++ gcc/config/avr/avr.c | 15 ++++++++++++++- gcc/config/avr/avr.h | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 124c7e50fab..8e2c29e69f8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-05-25 Marek Michalkiewicz + + * config/avr/avr.c (avr_handle_progmem_attribute): Handle TYPE_DECL. + + * config/avr/avr.h (BSS_SECTION_ASM_OP, ASM_OUTPUT_BSS): New. + 2002-05-25 Gabriel Dos Reis * toplev.c (output_clean_symbol_name): Fix another thinko. Gosh. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 3ba0eee33a4..b254c6ba027 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -4683,7 +4683,20 @@ avr_handle_progmem_attribute (node, name, args, flags, no_add_attrs) { if (DECL_P (*node)) { - if (TREE_STATIC (*node) || DECL_EXTERNAL (*node)) + if (TREE_CODE (*node) == TYPE_DECL) + { + /* This is really a decl attribute, not a type attribute, + but try to handle it for GCC 3.0 backwards compatibility. */ + + tree type = TREE_TYPE (*node); + tree attr = tree_cons (name, args, TYPE_ATTRIBUTES (type)); + tree newtype = build_type_attribute_variant (type, attr); + + TYPE_MAIN_VARIANT (newtype) = TYPE_MAIN_VARIANT (type); + TREE_TYPE (*node) = newtype; + *no_add_attrs = true; + } + else if (TREE_STATIC (*node) || DECL_EXTERNAL (*node)) { if (DECL_INITIAL (*node) == NULL_TREE && !DECL_EXTERNAL (*node)) { diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index ecbc1e5fda9..77950a72e6c 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -1698,6 +1698,15 @@ do { \ operation to identify the following data as writable initialized data. Normally `"\t.data"' is right. */ +#define BSS_SECTION_ASM_OP "\t.section .bss" +/* If defined, a C expression whose value is a string, including + spacing, containing the assembler operation to identify the + following data as uninitialized global data. If not defined, and + neither `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, + uninitialized global data will be output in the data section if + `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be + used. */ + #define EXTRA_SECTIONS in_progmem /* A list of names for sections other than the standard two, which are `in_text' and `in_data'. You need not define this macro on a @@ -1842,6 +1851,13 @@ do { \ This macro controls how the assembler definitions of uninitialized common global variables are output. */ +#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \ + asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED)) +/* A C statement (sans semicolon) to output to the stdio stream + STREAM the assembler definition of uninitialized global DECL named + NAME whose size is SIZE bytes. The variable ROUNDED is the size + rounded up to whatever alignment the caller wants. */ + #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \ do { \ fputs ("\t.lcomm ", (STREAM)); \ -- 2.30.2