From patchwork Sat Nov 19 12:04:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 126549 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 CB16BB7233 for ; Sat, 19 Nov 2011 23:04:36 +1100 (EST) Received: (qmail 20682 invoked by alias); 19 Nov 2011 12:04:33 -0000 Received: (qmail 20665 invoked by uid 22791); 19 Nov 2011 12:04:31 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from c2beaomr09.btconnect.com (HELO mail.btconnect.com) (213.123.26.187) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 19 Nov 2011 12:04:14 +0000 Received: from host81-138-1-83.in-addr.btopenworld.com (EHLO thor.office) ([81.138.1.83]) by c2beaomr09.btconnect.com with ESMTP id FFR54401; Sat, 19 Nov 2011 12:04:11 +0000 (GMT) Cc: Rainer Orth , GCC Patches , Richard Henderson , Mike Stump Message-Id: <89484C79-C459-4F0B-A2EF-53CBE78AA6B3@sandoe-acoustics.co.uk> From: Iain Sandoe To: "Joseph S. Myers" In-Reply-To: Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: [Patch] make it possible for the target to rename ".tm_clone_table" Date: Sat, 19 Nov 2011 12:04:09 +0000 References: <9B90055E-5374-4B02-8396-75502119DC89@sandoe-acoustics.co.uk> X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0303.4EC79B39.00B4, actions=tag X-Junkmail-Premium-Raw: score=8/50, refid=2.7.2:2011.11.19.90014:17:8.129, ip=81.138.1.83, rules=__MULTIPLE_RCPTS_CC_X2, __HAS_MSGID, __SANE_MSGID, __MSGID_APPLEMAIL, __TO_MALFORMED_2, __CT, __CTYPE_HAS_BOUNDARY, __CTYPE_MULTIPART, CTYPE_MULTIPART_NO_QUOTE, __CTYPE_MULTIPART_MIXED, __MIME_VERSION, __MIME_VERSION_APPLEMAIL, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __HAS_X_MAILER, __X_MAILER_APPLEMAIL, TXT_ATTACHED, __ANY_URI, __URI_NO_MAILTO, __URI_NO_WWW, __URI_NO_PATH, BODY_SIZE_4000_4999, BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, __USER_AGENT_APPLEMAIL, RDNS_SUSP, BODY_SIZE_7000_LESS, MIME_TEXT_ONLY_MP_MIXED, MULTIPLE_RCPTS X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0201.4EC79B3B.0165, ss=1, fgs=0, ip=0.0.0.0, so=2010-07-22 22:03:31, dmn=2009-09-10 00:05:08, mode=multiengine 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 On 18 Nov 2011, at 22:06, Joseph S. Myers wrote: > TM_CLONE_TABLE_SECTION_NAME would better be a target hook, not a > macro. ... done as below ... It should be possible for Rainer to define TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME to NULL, and have varasm use the normal data section for tm_clone_table sections. One might wish to re-adjust testsuite/gcc.dg/tm/20100615.c if that is done. OK for trunk? Iain gcc: * target.def (tm_clone_table_section_name): New hook. * doc/tm.texi.in (TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME): Define. * doc/tm.texi: Regenerate. * varasm.c (dump_tm_clone_pairs): Use target tm_clone_table_section_name if available, if that is NULL fall back to the data section. * config/darwin.h (TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME): New. gcc/testsuite: * gcc.dg/tm/20100615.c: Adjust for Darwin tm_clone_table section name. Index: gcc/doc/tm.texi.in =================================================================== --- gcc/doc/tm.texi.in (revision 181497) +++ gcc/doc/tm.texi.in (working copy) @@ -7013,6 +7013,8 @@ otherwise. @hook TARGET_ASM_MERGEABLE_RODATA_PREFIX +@hook TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME + @hook TARGET_ASM_SELECT_RTX_SECTION Return the section into which a constant @var{x}, of mode @var{mode}, should be placed. You can assume that @var{x} is some kind of Index: gcc/target.def =================================================================== --- gcc/target.def (revision 181497) +++ gcc/target.def (working copy) @@ -305,6 +305,16 @@ section names for mergeable constant data. Define the string if a different section name should be used.", const char *, ".rodata") +/* Set if the target wants to override the default ".tm_clone_table" + section name. */ +DEFHOOKPOD +(tm_clone_table_section_name, + "Define this macro to specify the section name that should be used\ + for transactional memory clone tables. If this is defined to NULL\ + the normal data section will be used for the tables instead.\ + The default section name is @code{\".tm_clone_table\"}.", + const char *, ".tm_clone_table") + /* Output a constructor for a symbol with a given priority. */ DEFHOOK (constructor, Index: gcc/testsuite/gcc.dg/tm/20100615.c =================================================================== --- gcc/testsuite/gcc.dg/tm/20100615.c (revision 181497) +++ gcc/testsuite/gcc.dg/tm/20100615.c (working copy) @@ -3,7 +3,8 @@ /* Since the non TM version of new_node() gets optimized away, it shouldn't appear in the clone table either. */ -/* { dg-final { scan-assembler-not "tm_clone_table" } } */ +/* { dg-final { scan-assembler-not "tm_clone_table" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not "__DATA,__tm_clone_table" { target *-*-darwin* } } } */ #define NULL 0 extern void *malloc (__SIZE_TYPE__); Index: gcc/varasm.c =================================================================== --- gcc/varasm.c (revision 181497) +++ gcc/varasm.c (working copy) @@ -5961,7 +5961,13 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_a if (!switched) { - switch_to_section (get_named_section (NULL, ".tm_clone_table", 3)); + if (targetm.asm_out.tm_clone_table_section_name) + switch_to_section (get_named_section + (NULL, + targetm.asm_out.tm_clone_table_section_name, + 3)); + else + switch_to_section (data_section); assemble_align (POINTER_SIZE); switched = true; } Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (revision 181497) +++ gcc/config/darwin.h (working copy) @@ -692,6 +692,10 @@ extern GTY(()) section * darwin_sections[NUM_DARWI #define TARGET_ASM_UNIQUE_SECTION darwin_unique_section #undef TARGET_ASM_FUNCTION_RODATA_SECTION #define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section + +#undef TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME +#define TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME "__DATA,__tm_clone_table" + #undef TARGET_ASM_RELOC_RW_MASK #define TARGET_ASM_RELOC_RW_MASK machopic_reloc_rw_mask