[Patch, AVR]: AVR backend cleanup: use elfos.h

Denis Chertykov chertykov@gmail.com
Mon Jun 27 17:04:00 GMT 2011


2011/6/27 Georg-Johann Lay <avr@gjlay.de>:
> This patch removes ELF dependencies from avr.h and redundancies from
> avr.h and avr.c
>
> The AVR BE defines many things that are readily available in elfos.h.
> ELF is the only target supported by avr-gcc.
>
> The patch includes elfos.h in config.gcc for all avr* targets together
> with a new file avr/elf.h.
>
> ELF for avr deviates in some points from elfos.h. The needed overrides
> are defined in avr/elf.h.  avr/elf.h is included after elfos.h because
> that is the only way to achieve the needed overrides/undefs.
>
> The patch removes some hundreds lines from the AVR BE which are
> redundant, and the new avr/elf.h makes it much clearer what the actual
> deviations to default ELF implementation are.
>
> Some overrides like that there is no .ident emitted by avr presumably
> have just historical reasons; anyway the patch tries to be neutral
> compared to the present implementation.
>
> Same applies for other defines like READONLY_DATA_SECTION_ASM_OP:
> .rodata is mapped to .data by avr ldscripts anyway, so there is
> actually no need to set readonly_data_section = data_section and
> merging of STRING_CST could save some space.
>
> For zeroes memory the patch will emit
>   .zero N
> instead of
>   .skip N,0
>
> Tested without regressions and asm-output diffed for real-world avr-code.
>
> Johann
>        * 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.
>        (IDENT_ASM_OP): Undefine.
>        (ASM_OUTPUT_IDENT): 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.
>

Approved.

Denis.



More information about the Gcc-patches mailing list