From patchwork Wed Jul 13 16:14:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 104556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 329741007D3 for ; Thu, 14 Jul 2011 02:15:15 +1000 (EST) Received: (qmail 26091 invoked by alias); 13 Jul 2011 16:15:10 -0000 Received: (qmail 25986 invoked by uid 22791); 13 Jul 2011 16:15:08 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.162) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Jul 2011 16:14:54 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by smtp.strato.de (klopstock mo47) (RZmta 26.0) with ESMTPA id K06e85n6DF93AE ; Wed, 13 Jul 2011 18:14:46 +0200 (MEST) Message-ID: <4E1DC475.5050900@gjlay.de> Date: Wed, 13 Jul 2011 18:14:45 +0200 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Eric Weddington , Anatoly Sokolov , Denis Chertykov Subject: [Patch,AVR]: Cleanup readonly_data_section et al. X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch removes some special treatment from avr/elf.h which is actually not needed. The only target supported by avr is ELF and the defaults for READONLY_DATA_SECTION_ASM_OP, TARGET_HAVE_SWITCHABLE_BSS_SECTIONS, and TARGET_ASM_SELECT_SECTION are fine. Using default for TARGET_ASM_SELECT_SECTION brings the additional benefit that constant merging is enabled. AVR is specific because it is Harvard Architecture so that all constants have to be in .data, i.e. .rodata is part of .data. This is accomplished by default linker scripts, so there is no need to set readonly_data_section = data_section in avr_asm_init_sections. Changes in testsuite run are: * gcc.dg/debug/dwarf2/dwarf-merge.c: UNSUPPORTED -> PASS * gcc.dg/array-quals-1.c: XFAIL -> PASS * g++.dg/opt/const4.C: FAIL -> PASS There's no avr maintainer approving at the moment, so approving by global reviewer is much appreciated. Ok to commit? Johann gcc/ * config/avr/elf.h (TARGET_ASM_SELECT_SECTION): Remove, i.e. use default_elf_select_section. (TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Remove. (READONLY_DATA_SECTION_ASM_OP): Remove. (TARGET_ASM_NAMED_SECTION): Move from here... * config/avr/avr.c: ...to here. (avr_asm_init_sections): Set unnamed callback of readonly_data_section. (avr_asm_named_section): Make static. testsuite/ * gcc.dg/array-quals-1.c: Don't xfail on AVR. Index: config/avr/elf.h =================================================================== --- config/avr/elf.h (revision 176136) +++ config/avr/elf.h (working copy) @@ -26,24 +26,12 @@ #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) \ Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 176141) +++ config/avr/avr.c (working copy) @@ -194,8 +194,8 @@ static const struct attribute_spec avr_a #undef TARGET_SECTION_TYPE_FLAGS #define TARGET_SECTION_TYPE_FLAGS avr_section_type_flags -/* `TARGET_ASM_NAMED_SECTION' must be defined in avr.h. */ - +#undef TARGET_ASM_NAMED_SECTION +#define TARGET_ASM_NAMED_SECTION avr_asm_named_section #undef TARGET_ASM_INIT_SECTIONS #define TARGET_ASM_INIT_SECTIONS avr_asm_init_sections #undef TARGET_ENCODE_SECTION_INFO @@ -5091,8 +5091,11 @@ avr_asm_init_sections (void) progmem_section = get_unnamed_section (AVR_HAVE_JMP_CALL ? 0 : SECTION_CODE, avr_output_progmem_section_asm_op, NULL); - readonly_data_section = data_section; + /* Override section callbacks to keep track of `avr_need_clear_bss_p' + resp. `avr_need_copy_data_p'. */ + + readonly_data_section->unnamed.callback = avr_output_data_section_asm_op; data_section->unnamed.callback = avr_output_data_section_asm_op; bss_section->unnamed.callback = avr_output_bss_section_asm_op; } @@ -5101,7 +5104,7 @@ avr_asm_init_sections (void) /* Implement `TARGET_ASM_NAMED_SECTION'. */ /* Track need of __do_clear_bss, __do_copy_data for named sections. */ -void +static void avr_asm_named_section (const char *name, unsigned int flags, tree decl) { if (!avr_need_copy_data_p) Index: testsuite/gcc.dg/array-quals-1.c =================================================================== --- testsuite/gcc.dg/array-quals-1.c (revision 176136) +++ testsuite/gcc.dg/array-quals-1.c (working copy) @@ -4,7 +4,7 @@ /* Origin: Joseph Myers */ /* { dg-do compile } */ /* The MMIX port always switches to the .data section at the end of a file. */ -/* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* picochip--*-* avr-*-*} } } */ +/* { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* x86_64-*-mingw* picochip--*-* } } } */ static const int a[2] = { 1, 2 }; const int a1[2] = { 1, 2 }; typedef const int ci;