+2011-06-28 Georg-Johann Lay <avr@gjlay.de>
+
+ * 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 <rearnsha@arm.com>
PR target/48637
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"
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);
#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
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
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);
}
/* 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
#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) \
#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 { \
#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) \
#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
#define DOLLARS_IN_IDENTIFIERS 0
-#define NO_DOLLAR_IN_LABEL 1
-
#define TRAMPOLINE_SIZE 4
/* Store in cc_status the expressions
#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)
--- /dev/null
+/* 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
+ <http://www.gnu.org/licenses/>. */
+
+
+/* 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