From: Georg-Johann Lay Date: Tue, 28 Jun 2011 07:26:09 +0000 (+0000) Subject: config.gcc (tm_file): Add elfos.h and avr/elf.h for avr-*-* and avr-*-rtems* targets. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=880962aca24018cf66e0abe583f1d82b8ccc5738;p=gcc.git config.gcc (tm_file): Add elfos.h and avr/elf.h for avr-*-* and avr-*-rtems* targets. * config.gcc (tm_file): Add elfos.h and avr/elf.h for avr-*-* and avr-*-rtems* targets. * config/avr/elf.h: New file. (ASM_OUTPUT_BEFORE_CASE_LABEL): Define. (TARGET_ASM_SELECT_SECTION): Define. (INIT_SECTION_ASM_OP): Undefine. (FINI_SECTION_ASM_OP): Undefine. (READONLY_DATA_SECTION_ASM_OP): Undefine. (PCC_BITFIELD_TYPE_MATTERS): Undefine. (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Undefine. * config/avr/avr.h: (PREFERRED_DEBUGGING_TYPE): Move to elf.h. (TARGET_ASM_NAMED_SECTION): Move to elf.h. (MAX_OFILE_ALIGNMENT): Move to elf.h. (STRING_LIMIT): Move to elf.h. (ASM_DECLARE_FUNCTION_NAME): Move to elf.h. (ASM_DECLARE_OBJECT_NAME): Remove. (ESCAPES): Remove. (ASM_OUTPUT_SKIP): Remove. (DWARF2_DEBUGGING_INFO): Remove. (OBJECT_FORMAT_ELF): Remove. (USER_LABEL_PREFIX): Remove. (ASM_OUTPUT_EXTERNAL): Remove. (ASM_OUTPUT_ASCII): Remove. (TYPE_ASM_OP): Remove. (SIZE_ASM_OP): Remove. (WEAK_ASM_OP): Remove. (STRING_ASM_OP): Remove. (SET_ASM_OP): Remove. (ASM_WEAKEN_LABEL): Remove. (TYPE_OPERAND_FMT): Remove. (ASM_DECLARE_FUNCTION_SIZE): Remove. (ASM_FINISH_DECLARE_OBJECT): Remove. (NO_DOLLAR_IN_LABEL): Remove. (ASM_GENERATE_INTERNAL_LABEL): Remove. (ASM_OUTPUT_CASE_LABEL): Remove. * config/avr/avr.c (avr_asm_output_aligned_decl_common): Use ASM_OUTPUT_ALIGNED_LOCAL, ASM_OUTPUT_ALIGNED_COMMON. (gas_output_ascii): Remove. (gas_output_limited_string): Remove. (TARGET_ASM_FILE_START_FILE_DIRECTIVE): Remove. * config/avr/avr-protos.h (gas_output_ascii): Remove prototye. (gas_output_limited_string): Remove prototype. From-SVN: r175575 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ebc1ce2392..dbe0762455f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,51 @@ +2011-06-28 Georg-Johann Lay + + * config.gcc (tm_file): Add elfos.h and avr/elf.h for + avr-*-* and avr-*-rtems* targets. + + * config/avr/elf.h: New file. + (ASM_OUTPUT_BEFORE_CASE_LABEL): Define. + (TARGET_ASM_SELECT_SECTION): Define. + (INIT_SECTION_ASM_OP): Undefine. + (FINI_SECTION_ASM_OP): Undefine. + (READONLY_DATA_SECTION_ASM_OP): Undefine. + (PCC_BITFIELD_TYPE_MATTERS): Undefine. + (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Undefine. + * config/avr/avr.h: + (PREFERRED_DEBUGGING_TYPE): Move to elf.h. + (TARGET_ASM_NAMED_SECTION): Move to elf.h. + (MAX_OFILE_ALIGNMENT): Move to elf.h. + (STRING_LIMIT): Move to elf.h. + (ASM_DECLARE_FUNCTION_NAME): Move to elf.h. + (ASM_DECLARE_OBJECT_NAME): Remove. + (ESCAPES): Remove. + (ASM_OUTPUT_SKIP): Remove. + (DWARF2_DEBUGGING_INFO): Remove. + (OBJECT_FORMAT_ELF): Remove. + (USER_LABEL_PREFIX): Remove. + (ASM_OUTPUT_EXTERNAL): Remove. + (ASM_OUTPUT_ASCII): Remove. + (TYPE_ASM_OP): Remove. + (SIZE_ASM_OP): Remove. + (WEAK_ASM_OP): Remove. + (STRING_ASM_OP): Remove. + (SET_ASM_OP): Remove. + (ASM_WEAKEN_LABEL): Remove. + (TYPE_OPERAND_FMT): Remove. + (ASM_DECLARE_FUNCTION_SIZE): Remove. + (ASM_FINISH_DECLARE_OBJECT): Remove. + (NO_DOLLAR_IN_LABEL): Remove. + (ASM_GENERATE_INTERNAL_LABEL): Remove. + (ASM_OUTPUT_CASE_LABEL): Remove. + * config/avr/avr.c (avr_asm_output_aligned_decl_common): Use + ASM_OUTPUT_ALIGNED_LOCAL, ASM_OUTPUT_ALIGNED_COMMON. + (gas_output_ascii): Remove. + (gas_output_limited_string): Remove. + (TARGET_ASM_FILE_START_FILE_DIRECTIVE): Remove. + * config/avr/avr-protos.h + (gas_output_ascii): Remove prototye. + (gas_output_limited_string): Remove prototype. + 2011-06-27 Richard Earnshaw PR target/48637 diff --git a/gcc/config.gcc b/gcc/config.gcc index 14c7a81f45b..37dd5cd705c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -936,13 +936,13 @@ arm*-wince-pe*) extra_objs="pe.o" ;; avr-*-rtems*) - tm_file="avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h" + tm_file="elfos.h avr/elf.h avr/avr.h dbxelf.h avr/rtems.h rtems.h newlib-stdint.h" tmake_file="avr/t-avr t-rtems avr/t-rtems" extra_gcc_objs="driver-avr.o avr-devices.o" extra_objs="avr-devices.o" ;; avr-*-*) - tm_file="avr/avr.h dbxelf.h newlib-stdint.h" + tm_file="elfos.h avr/elf.h avr/avr.h dbxelf.h newlib-stdint.h" use_gcc_stdint=wrap extra_gcc_objs="driver-avr.o avr-devices.o" extra_objs="avr-devices.o" diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 2f3e93d883c..6d06af8153a 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -30,8 +30,6 @@ extern void avr_asm_declare_function_name (FILE *, const char *, tree); extern void order_regs_for_local_alloc (void); extern int avr_initial_elimination_offset (int from, int to); extern int avr_simple_epilogue (void); -extern void gas_output_limited_string (FILE *file, const char *str); -extern void gas_output_ascii (FILE *file, const char *str, size_t length); extern int avr_hard_regno_rename_ok (unsigned int, unsigned int); extern rtx avr_return_addr_rtx (int count, rtx tem); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 2b1aaf09746..efd9f7209cb 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -169,8 +169,6 @@ static const struct attribute_spec avr_attribute_table[] = #define TARGET_ASM_INTEGER avr_assemble_integer #undef TARGET_ASM_FILE_START #define TARGET_ASM_FILE_START avr_file_start -#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE -#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END avr_file_end @@ -4897,99 +4895,6 @@ avr_asm_declare_function_name (FILE *file, const char *name, tree decl) ASM_OUTPUT_LABEL (file, name); } -/* The routine used to output NUL terminated strings. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable, especially for targets like the i386 - (where the only alternative is to output character sequences as - comma separated lists of numbers). */ - -void -gas_output_limited_string(FILE *file, const char *str) -{ - const unsigned char *_limited_str = (const unsigned char *) str; - unsigned ch; - fprintf (file, "%s\"", STRING_ASM_OP); - for (; (ch = *_limited_str); _limited_str++) - { - int escape; - switch (escape = ESCAPES[ch]) - { - case 0: - putc (ch, file); - break; - case 1: - fprintf (file, "\\%03o", ch); - break; - default: - putc ('\\', file); - putc (escape, file); - break; - } - } - fprintf (file, "\"\n"); -} - -/* The routine used to output sequences of byte values. We use a special - version of this for most svr4 targets because doing so makes the - generated assembly code more compact (and thus faster to assemble) - as well as more readable. Note that if we find subparts of the - character sequence which end with NUL (and which are shorter than - STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ - -void -gas_output_ascii(FILE *file, const char *str, size_t length) -{ - const unsigned char *_ascii_bytes = (const unsigned char *) str; - const unsigned char *limit = _ascii_bytes + length; - unsigned bytes_in_chunk = 0; - for (; _ascii_bytes < limit; _ascii_bytes++) - { - const unsigned char *p; - if (bytes_in_chunk >= 60) - { - fprintf (file, "\"\n"); - bytes_in_chunk = 0; - } - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) - continue; - if (p < limit && (p - _ascii_bytes) <= (signed)STRING_LIMIT) - { - if (bytes_in_chunk > 0) - { - fprintf (file, "\"\n"); - bytes_in_chunk = 0; - } - gas_output_limited_string (file, (const char*)_ascii_bytes); - _ascii_bytes = p; - } - else - { - int escape; - unsigned ch; - if (bytes_in_chunk == 0) - fprintf (file, "\t.ascii\t\""); - switch (escape = ESCAPES[ch = *_ascii_bytes]) - { - case 0: - putc (ch, file); - bytes_in_chunk++; - break; - case 1: - fprintf (file, "\\%03o", ch); - bytes_in_chunk += 4; - break; - default: - putc ('\\', file); - putc (escape, file); - bytes_in_chunk += 2; - break; - } - } - } - if (bytes_in_chunk > 0) - fprintf (file, "\"\n"); -} /* Return value is nonzero if pseudos that have been assigned to registers of class CLASS would likely be spilled @@ -5169,17 +5074,9 @@ avr_asm_output_aligned_decl_common (FILE * stream, const_tree decl ATTRIBUTE_UNU avr_need_clear_bss_p = true; if (local_p) - { - fputs ("\t.local\t", stream); - assemble_name (stream, name); - fputs ("\n", stream); - } - - fputs ("\t.comm\t", stream); - assemble_name (stream, name); - fprintf (stream, - "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", - size, align / BITS_PER_UNIT); + ASM_OUTPUT_ALIGNED_LOCAL (stream, name, size, align); + else + ASM_OUTPUT_ALIGNED_COMMON (stream, name, size, align); } diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 5f4ceff0214..9b27f703807 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -150,8 +150,6 @@ extern GTY(()) section *progmem_section; /* No data type wants to be aligned rounder than this. */ #define BIGGEST_ALIGNMENT 8 -#define MAX_OFILE_ALIGNMENT (32768 * 8) - #define TARGET_VTABLE_ENTRY_ALIGN 8 #define STRICT_ALIGNMENT 0 @@ -457,11 +455,6 @@ do { \ #define ASM_APP_OFF "/* #NOAPP */\n" -/* Switch into a generic section. */ -#define TARGET_ASM_NAMED_SECTION avr_asm_named_section - -#define ASM_OUTPUT_ASCII(FILE, P, SIZE) gas_output_ascii (FILE,P,SIZE) - #define IS_ASM_LOGICAL_LINE_SEPARATOR(C, STR) ((C) == '\n' || ((C) == '$')) #define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \ @@ -473,121 +466,11 @@ do { \ #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGN) \ avr_asm_output_aligned_decl_common (STREAM, DECL, NAME, SIZE, ALIGN, true) -#undef TYPE_ASM_OP -#undef SIZE_ASM_OP -#undef WEAK_ASM_OP -#define TYPE_ASM_OP "\t.type\t" -#define SIZE_ASM_OP "\t.size\t" -#define WEAK_ASM_OP "\t.weak\t" -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - - -#undef TYPE_OPERAND_FMT -#define TYPE_OPERAND_FMT "@%s" -/* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ -avr_asm_declare_function_name ((FILE), (NAME), (DECL)) - -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ - } while (0) - -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ -do { \ - ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, \ - int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ -} while (0) - -#undef ASM_FINISH_DECLARE_OBJECT -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - HOST_WIDE_INT size; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - size = int_size_in_bytes (TREE_TYPE (DECL)); \ - ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ - } \ - } while (0) - - -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" -/* A table of bytes codes used by the ASM_OUTPUT_ASCII and - ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table - corresponds to a particular byte value [0..255]. For any - given byte value, if the value in the corresponding table - position is zero, the given character can be output directly. - If the table value is 1, the byte must be output as a \ooo - octal escape. If the tables value is anything else, then the - byte value should be output as a \ followed by the value - in the table. Note that we can use standard UN*X escape - sequences for many control characters, but we don't use - \a to represent BEL because some svr4 assemblers (e.g. on - the i386) don't know about that. Also, we don't use \v - since some versions of gas, such as 2.2 did not accept it. */ - -#define STRING_LIMIT ((unsigned) 64) -#define STRING_ASM_OP "\t.string\t" -/* Some svr4 assemblers have a limit on the number of characters which - can appear in the operand of a .string directive. If your assembler - has such a limitation, you should define STRING_LIMIT to reflect that - limit. Note that at least some svr4 assemblers have a limit on the - actual number of bytes in the double-quoted string, and that they - count each character in an escape sequence as one byte. Thus, an - escape sequence like \377 would count as four bytes. - - If your target assembler doesn't support the .string directive, you - should define this to zero. */ - /* Globalizing directive for a label. */ #define GLOBAL_ASM_OP ".global\t" -#define SET_ASM_OP "\t.set\t" - -#define ASM_WEAKEN_LABEL(FILE, NAME) \ - do \ - { \ - fputs ("\t.weak\t", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fputc ('\n', (FILE)); \ - } \ - while (0) - #define SUPPORTS_WEAK 1 -#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ -sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM)) - #define HAS_INIT_SECTION 1 #define REGISTER_NAMES { \ @@ -605,8 +488,6 @@ sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM)) #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X) -#define USER_LABEL_PREFIX "" - #define ASSEMBLER_DIALECT AVR_HAVE_MOVW #define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \ @@ -624,22 +505,12 @@ sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM)) #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ avr_output_addr_vec_elt(STREAM, VALUE) -#define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \ - (switch_to_section (progmem_section), \ - (*targetm.asm_out.internal_label) (STREAM, PREFIX, NUM)) - -#define ASM_OUTPUT_SKIP(STREAM, N) \ -fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N)) - #define ASM_OUTPUT_ALIGN(STREAM, POWER) \ do { \ if ((POWER) > 1) \ fprintf (STREAM, "\t.p2align\t%d\n", POWER); \ } while (0) -#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ - default_elf_asm_output_external (FILE, DECL, NAME) - #define CASE_VECTOR_MODE HImode #undef WORD_REGISTER_OPERATIONS @@ -654,8 +525,6 @@ fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N)) #define DOLLARS_IN_IDENTIFIERS 0 -#define NO_DOLLAR_IN_LABEL 1 - #define TRAMPOLINE_SIZE 4 /* Store in cc_status the expressions @@ -757,14 +626,8 @@ mmcu=*:-mmcu=%*}" #define OUT_AS2(a,b,c) output_asm_insn (AS2(a,b,c), operands) #define CR_TAB "\n\t" -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#define DWARF2_DEBUGGING_INFO 1 - #define DWARF2_ADDR_SIZE 4 -#define OBJECT_FORMAT_ELF - #define INCOMING_RETURN_ADDR_RTX avr_incoming_return_addr_rtx () #define INCOMING_FRAME_SP_OFFSET (AVR_3_BYTE_PC ? 3 : 2) diff --git a/gcc/config/avr/elf.h b/gcc/config/avr/elf.h new file mode 100644 index 00000000000..9bbd32fd7b1 --- /dev/null +++ b/gcc/config/avr/elf.h @@ -0,0 +1,58 @@ +/* Copyright (C) 2011 + Free Software Foundation, Inc. + Contributed by Georg-Johann Lay (avr@gjlay.de) + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + + +/* Overriding some definitions from elfos.h for AVR. */ + +#undef PCC_BITFIELD_TYPE_MATTERS + +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION avr_asm_named_section + +/* Use lame default: no string merging, ... */ +#undef TARGET_ASM_SELECT_SECTION +#define TARGET_ASM_SELECT_SECTION default_select_section + +#undef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT (32768 * 8) + +#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS + +#undef STRING_LIMIT +#define STRING_LIMIT ((unsigned) 64) + +/* Setup `readonly_data_section' in `avr_asm_init_sections'. */ +#undef READONLY_DATA_SECTION_ASM_OP + +/* Take care of `signal' and `interrupt' attributes. */ +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + avr_asm_declare_function_name ((FILE), (NAME), (DECL)) + +#undef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \ + switch_to_section (progmem_section); + +/* Be conservative in crtstuff.c. */ +#undef INIT_SECTION_ASM_OP +#undef FINI_SECTION_ASM_OP