From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32371 invoked by alias); 21 Jun 2011 23:24:05 -0000 Received: (qmail 32355 invoked by uid 22791); 21 Jun 2011 23:24:04 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,TW_XG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Jun 2011 23:23:49 +0000 Received: (qmail 20842 invoked from network); 21 Jun 2011 23:23:48 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 21 Jun 2011 23:23:48 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1QZAGH-0006qc-5Y for gcc-patches@gcc.gnu.org; Tue, 21 Jun 2011 23:21:37 +0000 Date: Tue, 21 Jun 2011 23:26:00 -0000 From: "Joseph S. Myers" To: gcc-patches@gcc.gnu.org Subject: Clean up TARGET_ASM_NAMED_SECTION defaults Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg01644.txt.bz2 I noted in the fragile nature of the default of TARGET_HAVE_NAMED_SECTIONS based on TARGET_ASM_NAMED_SECTION (relying on (a) TARGET_ASM_NAMED_SECTION being defined in tm.h not a .c file and (b) the order in which headers are included). This patch simplifies the logic and makes it less fragile by defaulting TARGET_HAVE_NAMED_SECTIONS to "true" - which is correct for almost all targets - and then explicitly defining it to "false" for the targets without named section support. Although this duplicates information from TARGET_ASM_NAMED_SECTION, I think doing so is better than the fragile dependencies listed above. Bootstrapped with no regressions on x86_64-unknown-linux-gnu, and tested building cc1 and xgcc for crosses to: alpha-dec-osf5.1 hppa2.0w-hp-hpux11.23 i686-openbsd2 m32c-elf m68k-openbsd pdp11-none vax-openbsd. (vax-openbsd failed because of the pre-existing PR 47122.) OK to commit? (My inclination is that the OpenBSD targets without named sections - presumably a.out - should be deprecated. In the case of the x86 target FSF GCC also has a more recent OpenBSD target with named section support; for the other architectures there isn't a more recent target in FSF GCC and I don't know if OpenBSD's own toolchain has since moved to ELF on M68K or VAX.) 2011-06-21 Joseph Myers * common/common-target-def.h (TARGET_HAVE_NAMED_SECTIONS): Don't default based on TARGET_ASM_NAMED_SECTION. * common/common-target.def (have_named_sections): Default to true. * common/config/default-common.c: Don't include tm.h. * common/config/picochip/picochip-common.c (TARGET_HAVE_NAMED_SECTIONS): Don't define. * common/config/m32c/m32c-common.c: Remove. * config.gcc (m32c*-*-*): Set target_has_targetm_common=no. * config/alpha/osf5.h (TARGET_HAVE_NAMED_SECTIONS): Define to false. * config/i386/openbsd.h (TARGET_HAVE_NAMED_SECTIONS): Define to false. * config/m68k/openbsd.h (TARGET_HAVE_NAMED_SECTIONS): Define to false. * config/pa/som.h (TARGET_HAVE_NAMED_SECTIONS): Define to false. * config/pdp11/pdp11.h (TARGET_HAVE_NAMED_SECTIONS): Define to false. * config/vax/openbsd.h (TARGET_HAVE_NAMED_SECTIONS): Define to false. Index: gcc/common/config/m32c/m32c-common.c =================================================================== --- gcc/common/config/m32c/m32c-common.c (revision 175248) +++ gcc/common/config/m32c/m32c-common.c (working copy) @@ -1,31 +0,0 @@ -/* Common hooks for R8C/M16C/M32C. - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. - - 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 - . */ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "tm.h" -#include "common/common-target.h" -#include "common/common-target-def.h" - -#undef TARGET_HAVE_NAMED_SECTIONS -#define TARGET_HAVE_NAMED_SECTIONS true - -struct gcc_targetm_common targetm_common = TARGETM_COMMON_INITIALIZER; Index: gcc/common/config/default-common.c =================================================================== --- gcc/common/config/default-common.c (revision 175248) +++ gcc/common/config/default-common.c (working copy) @@ -21,12 +21,10 @@ along with GCC; see the file COPYING3. #include "config.h" #include "system.h" #include "coretypes.h" -#include "tm.h" /* For TARGET_ASM_NAMED_SECTION used in default for - TARGET_HAVE_NAMED_SECTIONS. */ #include "common/common-target.h" #include "common/common-target-def.h" -/* FIXME: Do not include tm.h or tm_p.h here; if it is useful for a target to +/* Do not include tm.h or tm_p.h here; if it is useful for a target to define some macros for the initializer in a header without defining targetm_common itself (for example, because of interactions with some hooks depending on the target OS and others on the target Index: gcc/common/config/picochip/picochip-common.c =================================================================== --- gcc/common/config/picochip/picochip-common.c (revision 175248) +++ gcc/common/config/picochip/picochip-common.c (working copy) @@ -31,9 +31,6 @@ static const struct default_options pico { OPT_LEVELS_NONE, 0, NULL, 0 } }; -#undef TARGET_HAVE_NAMED_SECTIONS -#define TARGET_HAVE_NAMED_SECTIONS 1 - #undef TARGET_OPTION_OPTIMIZATION_TABLE #define TARGET_OPTION_OPTIMIZATION_TABLE picochip_option_optimization_table Index: gcc/common/common-target.def =================================================================== --- gcc/common/common-target.def (revision 175248) +++ gcc/common/common-target.def (working copy) @@ -86,7 +86,7 @@ DEFHOOKPOD DEFHOOKPOD (have_named_sections, "", - bool, false) + bool, true) DEFHOOKPOD (always_strip_dotdot, Index: gcc/common/common-target-def.h =================================================================== --- gcc/common/common-target-def.h (revision 175248) +++ gcc/common/common-target-def.h (working copy) @@ -16,10 +16,6 @@ along with this program; see the file COPYING3. If not see . */ -#ifdef TARGET_ASM_NAMED_SECTION -#define TARGET_HAVE_NAMED_SECTIONS true -#endif - #include "common/common-target-hooks-def.h" #include "hooks.h" #include "common/common-targhooks.h" Index: gcc/config.gcc =================================================================== --- gcc/config.gcc (revision 175248) +++ gcc/config.gcc (working copy) @@ -298,6 +298,7 @@ case ${target} in m32c*-*-*) cpu_type=m32c tmake_file=m32c/t-m32c + target_has_targetm_common=no ;; alpha*-*-*) cpu_type=alpha Index: gcc/config/alpha/osf5.h =================================================================== --- gcc/config/alpha/osf5.h (revision 175248) +++ gcc/config/alpha/osf5.h (working copy) @@ -259,3 +259,5 @@ along with GCC; see the file COPYING3. /* Handle #pragma extern_prefix. */ #define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 1 + +#define TARGET_HAVE_NAMED_SECTIONS false Index: gcc/config/i386/openbsd.h =================================================================== --- gcc/config/i386/openbsd.h (revision 175248) +++ gcc/config/i386/openbsd.h (working copy) @@ -98,3 +98,5 @@ along with GCC; see the file COPYING3. /* OpenBSD gas currently does not support quad, so do not use it. */ #undef ASM_QUAD + +#define TARGET_HAVE_NAMED_SECTIONS false Index: gcc/config/pdp11/pdp11.h =================================================================== --- gcc/config/pdp11/pdp11.h (revision 175248) +++ gcc/config/pdp11/pdp11.h (working copy) @@ -664,3 +664,5 @@ extern rtx cc0_reg_rtx; #define COMPARE_FLAG_MODE HImode + +#define TARGET_HAVE_NAMED_SECTIONS false Index: gcc/config/m68k/openbsd.h =================================================================== --- gcc/config/m68k/openbsd.h (revision 175248) +++ gcc/config/m68k/openbsd.h (working copy) @@ -1,5 +1,5 @@ /* Configuration file for an m68k OpenBSD target. - Copyright (C) 1999, 2002, 2003, 2007, 2009, 2010 + Copyright (C) 1999, 2002, 2003, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -87,3 +87,5 @@ along with GCC; see the file COPYING3. /* All configurations that don't use elf must be explicit about not using dwarf unwind information. */ #define DWARF2_UNWIND_INFO 0 + +#define TARGET_HAVE_NAMED_SECTIONS false Index: gcc/config/pa/som.h =================================================================== --- gcc/config/pa/som.h (revision 175248) +++ gcc/config/pa/som.h (working copy) @@ -340,3 +340,5 @@ do { \ /* Shared library suffix. Collect2 strips the version string after this suffix when generating constructor/destructor names. */ #define SHLIB_SUFFIX ".sl" + +#define TARGET_HAVE_NAMED_SECTIONS false Index: gcc/config/vax/openbsd.h =================================================================== --- gcc/config/vax/openbsd.h (revision 175248) +++ gcc/config/vax/openbsd.h (working copy) @@ -1,5 +1,5 @@ /* Configuration fragment for a VAX OpenBSD target. - Copyright (C) 2000, 2002, 2007 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2007, 2009, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -46,3 +46,5 @@ along with GCC; see the file COPYING3. #undef WINT_TYPE #define WINT_TYPE "int" + +#define TARGET_HAVE_NAMED_SECTIONS false -- Joseph S. Myers joseph@codesourcery.com