Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-22 Thread Iain Sandoe


On 21 Nov 2011, at 00:17, Richard Henderson wrote:


On 11/20/2011 05:34 AM, Iain Sandoe wrote:


gcc:

   * target.def (tm_clone_table_section): New hook.
   * doc/tm.texi.in (TARGET_ASM_TM_CLONE_TABLE_SECTION): Define.
   * doc/tm.texi: Regenerate.
   * varasm.c (dump_tm_clone_pairs): Use target  
tm_clone_table_section.

   * config/darwin.h (TARGET_ASM_TM_CLONE_TABLE_SECTION): New.
   * config/darwin-protos.h (darwin_tm_clone_table_section): New  
prototype.

   * config/darwin.c (darwin_tm_clone_table_section): New.

gcc/testsuite:

   * gcc.dg/tm/20100615.c: Adjust for Darwin tm_clone_table section  
name.


Ok.


This is what I committed (r181613)after accounting for:
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg02069.html
and
point 2 in http://gcc.gnu.org/ml/gcc-patches/2011-11/msg02155.html
(and noting that I'd missed output.h from the original ChangeLog)

Iain

Index: gcc/doc/tm.texi
===
--- gcc/doc/tm.texi (revision 181611)
+++ gcc/doc/tm.texi (working copy)
@@ -7090,6 +7090,10 @@ section names for mergeable constant data.  Define
 the string if a different section name should be used.
 @end deftypevr
 
+@deftypefn {Target Hook} {section *} TARGET_ASM_TM_CLONE_TABLE_SECTION (void)
+Return the section that should be used for transactional memory clone  tables.
+@end deftypefn
+
 @deftypefn {Target Hook} {section *} TARGET_ASM_SELECT_RTX_SECTION (enum 
machine_mode @var{mode}, rtx @var{x}, unsigned HOST_WIDE_INT @var{align})
 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/doc/tm.texi.in
===
--- gcc/doc/tm.texi.in  (revision 181611)
+++ 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
+
 @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 181611)
+++ gcc/target.def  (working copy)
@@ -305,6 +305,13 @@ section names for mergeable constant data.  Define
 the string if a different section name should be used.,
  const char *, .rodata)
 
+/* Return the section to be used for transactional memory clone tables.  */
+DEFHOOK
+(tm_clone_table_section,
+ Return the section that should be used for transactional memory clone\
+  tables.,
+ section *, (void), default_clone_table_section)
+
 /* 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 181611)
+++ 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 181611)
+++ gcc/varasm.c(working copy)
@@ -5961,7 +5961,7 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_a
 
   if (!switched)
{
- switch_to_section (get_named_section (NULL, .tm_clone_table, 3));
+ switch_to_section (targetm.asm_out.tm_clone_table_section ());
  assemble_align (POINTER_SIZE);
  switched = true;
}
@@ -5973,6 +5973,14 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_a
 }
 }
 
+/* Provide a default for the tm_clone_table section.  */
+
+section *
+default_clone_table_section (void)
+{
+  return get_named_section (NULL, .tm_clone_table, 3);
+}
+
 /* Helper comparison function for qsorting by the DECL_UID stored in
alias_pair-emitted_diags.  */
 
Index: gcc/output.h
===
--- gcc/output.h(revision 181611)
+++ gcc/output.h(working copy)
@@ -638,6 +638,7 @@ extern section *default_elf_select_section (tree,
 extern void default_unique_section (tree, int);
 extern section *default_function_rodata_section (tree);
 extern section *default_no_function_rodata_section (tree);
+extern section *default_clone_table_section (void);
 extern section *default_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
 extern section *default_elf_select_rtx_section (enum machine_mode, rtx,
Index: 

Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-21 Thread Pedro Alves
On Sunday 20 November 2011 15:34:54, Iain Sandoe wrote:
 +#undef  TARGET_ASM_TM_CLONE_TABLE_SECTION_NAME
 +#define TARGET_ASM_TM_CLONE_TABLE_SECTION darwin_tm_clone_table_section

#undef  TARGET_ASM_TM_CLONE_TABLE_SECTION

probably.

-- 
Pedro Alves


Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-20 Thread Iain Sandoe

Hi Richard,

On 19 Nov 2011, at 18:43, Richard Henderson wrote:


On 11/19/2011 02:04 AM, Iain Sandoe wrote:

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.


Well, not really.  OSF is going to need an extension to collect2 in
order to create a single table, or changes to other bits of the
compiler to invoke _ITM_registerTMCloneTable for each object file's
table.

... actually, there seems to be some sort of merge error.  I don't
see the crtstuff.c changes that called _ITM_registerTMCloneTable in
the first place.


This might go some way to explaining my confusion  :-)
.. I did try to find any other reference to .tm_clone_table in the  
code and failed ...


(varasm.c and the testsuite entry are the only two refs I can see).


I'd prefer we return a section object instead.  I.e. pull the
call to get_named_section into the hook as well.


as per attached?
Iain


gcc:

* target.def (tm_clone_table_section): New hook.
* doc/tm.texi.in (TARGET_ASM_TM_CLONE_TABLE_SECTION): Define.
* doc/tm.texi: Regenerate.
* varasm.c (dump_tm_clone_pairs): Use target tm_clone_table_section.
* config/darwin.h (TARGET_ASM_TM_CLONE_TABLE_SECTION): New.
	* config/darwin-protos.h (darwin_tm_clone_table_section): New  
prototype.

* config/darwin.c (darwin_tm_clone_table_section): New.

gcc/testsuite:

* gcc.dg/tm/20100615.c: Adjust for Darwin tm_clone_table section name.



Index: gcc/varasm.c
===
--- gcc/varasm.c(revision 181530)
+++ gcc/varasm.c(working copy)
@@ -5961,7 +5961,7 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_a
 
   if (!switched)
{
- switch_to_section (get_named_section (NULL, .tm_clone_table, 3));
+ switch_to_section (targetm.asm_out.tm_clone_table_section ());
  assemble_align (POINTER_SIZE);
  switched = true;
}
@@ -5973,6 +5973,14 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_a
 }
 }
 
+/* Provide a default for the tm_clone_table section.  */
+
+section *
+default_clone_table_section (void)
+{
+  return get_named_section (NULL, .tm_clone_table, 3);
+}
+
 /* Helper comparison function for qsorting by the DECL_UID stored in
alias_pair-emitted_diags.  */
 
Index: gcc/target.def
===
--- gcc/target.def  (revision 181530)
+++ gcc/target.def  (working copy)
@@ -305,6 +305,13 @@ section names for mergeable constant data.  Define
 the string if a different section name should be used.,
  const char *, .rodata)
 
+/* Return the section to be used for transactional memory clone tables.  */
+DEFHOOK
+(tm_clone_table_section,
+ Return the section that should be used for transactional memory clone\
+  tables.,
+ section *, (void), default_clone_table_section)
+
 /* Output a constructor for a symbol with a given priority.  */
 DEFHOOK
 (constructor,
Index: gcc/config/darwin.h
===
--- gcc/config/darwin.h (revision 181530)
+++ gcc/config/darwin.h (working copy)
@@ -697,6 +697,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 darwin_tm_clone_table_section
+
 #undef  TARGET_ASM_RELOC_RW_MASK
 #define TARGET_ASM_RELOC_RW_MASK machopic_reloc_rw_mask
 
Index: gcc/config/darwin.c
===
--- gcc/config/darwin.c (revision 181530)
+++ gcc/config/darwin.c (working copy)
@@ -1265,6 +1265,12 @@ darwin_mergeable_constant_section (tree exp,
   return readonly_data_section;
 }
 
+section *
+darwin_tm_clone_table_section (void)
+{
+  return get_named_section (NULL, __DATA,__tm_clone_table, 3);
+}
+
 int
 machopic_reloc_rw_mask (void)
 {
Index: gcc/config/darwin-protos.h
===
--- gcc/config/darwin-protos.h  (revision 181530)
+++ gcc/config/darwin-protos.h  (working copy)
@@ -58,6 +58,7 @@ extern int machopic_reloc_rw_mask (void);
 extern section *machopic_select_section (tree, int, unsigned HOST_WIDE_INT);
 
 extern section *darwin_function_section (tree, enum node_frequency, bool, 
bool); 
+extern section *darwin_tm_clone_table_section (void);
 extern void darwin_function_switched_text_sections (FILE *, tree, bool);
 
 extern void darwin_unique_section (tree decl, int reloc);
Index: gcc/doc/tm.texi.in
===
--- gcc/doc/tm.texi.in  (revision 181530)
+++ 

Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-20 Thread Richard Henderson
On 11/20/2011 05:34 AM, Iain Sandoe wrote:
 
 gcc:
 
 * target.def (tm_clone_table_section): New hook.
 * doc/tm.texi.in (TARGET_ASM_TM_CLONE_TABLE_SECTION): Define.
 * doc/tm.texi: Regenerate.
 * varasm.c (dump_tm_clone_pairs): Use target tm_clone_table_section.
 * config/darwin.h (TARGET_ASM_TM_CLONE_TABLE_SECTION): New.
 * config/darwin-protos.h (darwin_tm_clone_table_section): New prototype.
 * config/darwin.c (darwin_tm_clone_table_section): New.
 
 gcc/testsuite:
 
 * gcc.dg/tm/20100615.c: Adjust for Darwin tm_clone_table section name.

Ok.


r~


Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-19 Thread Iain Sandoe


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
 






Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-19 Thread Mike Stump
On Nov 19, 2011, at 4:04 AM, Iain Sandoe wrote:
 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?

Darwin bits Ok.  One step closer...


Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-19 Thread Richard Henderson
On 11/19/2011 02:04 AM, Iain Sandoe wrote:
 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.

Well, not really.  OSF is going to need an extension to collect2 in
order to create a single table, or changes to other bits of the 
compiler to invoke _ITM_registerTMCloneTable for each object file's
table.

... actually, there seems to be some sort of merge error.  I don't
see the crtstuff.c changes that called _ITM_registerTMCloneTable in
the first place.

 +/* 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)

I'd prefer we return a section object instead.  I.e. pull the
call to get_named_section into the hook as well.


r~


[Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Iain Sandoe

At least Darwin needs a different name for the tm_clone_table section.

I'm wondering what a target without named sections does for this - is  
there some reason it needs to be in a separate section (from data)...


... perhaps what I'm missing here will help understand why the clone  
tests fail on *x68*-darwin :-)


comments/OK for trunk?
Iain

gcc:

* defaults.h (TM_CLONE_TABLE_SECTION_NAME): Provide default
tm clone section name.
* varasm.c (dump_tm_clone_pairs): Use TM_CLONE_TABLE_SECTION_NAME.
* config/darwin.h (TM_CLONE_TABLE_SECTION_NAME): Define.

Index: gcc/defaults.h
===
--- gcc/defaults.h  (revision 181476)
+++ gcc/defaults.h  (working copy)
@@ -392,6 +392,14 @@ see the files COPYING3 and COPYING.RUNTIME respect
 #endif
 #endif
 
+/* If we have named sections, provide a name for the transaction clone
+   table section.  */
+#if defined (TARGET_ASM_NAMED_SECTION)
+#ifndef TM_CLONE_TABLE_SECTION_NAME
+#define TM_CLONE_TABLE_SECTION_NAME .tm_clone_table
+#endif
+#endif
+
 /* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time.  */
Index: gcc/varasm.c
===
--- gcc/varasm.c(revision 181476)
+++ gcc/varasm.c(working copy)
@@ -5961,7 +5961,9 @@ dump_tm_clone_pairs (VEC(tm_alias_pair,heap) *tm_a
 
   if (!switched)
{
- switch_to_section (get_named_section (NULL, .tm_clone_table, 3));
+ switch_to_section (get_named_section (NULL, 
+   TM_CLONE_TABLE_SECTION_NAME,
+   3));
  assemble_align (POINTER_SIZE);
  switched = true;
}
Index: gcc/config/darwin.h
===
--- gcc/config/darwin.h (revision 181476)
+++ gcc/config/darwin.h (working copy)
@@ -692,6 +680,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  TM_CLONE_TABLE_SECTION_NAME
+#define 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
 






Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Rainer Orth
Iain Sandoe develo...@sandoe-acoustics.co.uk writes:

 Index: gcc/defaults.h
 ===
 --- gcc/defaults.h(revision 181476)
 +++ gcc/defaults.h(working copy)
 @@ -392,6 +392,14 @@ see the files COPYING3 and COPYING.RUNTIME respect
  #endif
  #endif
  
 +/* If we have named sections, provide a name for the transaction clone
 +   table section.  */
 +#if defined (TARGET_ASM_NAMED_SECTION)
 +#ifndef TM_CLONE_TABLE_SECTION_NAME
 +#define TM_CLONE_TABLE_SECTION_NAME .tm_clone_table
 +#endif
 +#endif
 +

This, together with the unconditional use in varasm.c, will lead to a
bootstrap failure on Tru64 UNIX, which lacks named sections completely.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Iain Sandoe


On 18 Nov 2011, at 17:56, Rainer Orth wrote:


Iain Sandoe develo...@sandoe-acoustics.co.uk writes:


Index: gcc/defaults.h
===
--- gcc/defaults.h  (revision 181476)
+++ gcc/defaults.h  (working copy)
@@ -392,6 +392,14 @@ see the files COPYING3 and COPYING.RUNTIME  
respect

#endif
#endif

+/* If we have named sections, provide a name for the transaction  
clone

+   table section.  */
+#if defined (TARGET_ASM_NAMED_SECTION)
+#ifndef TM_CLONE_TABLE_SECTION_NAME
+#define TM_CLONE_TABLE_SECTION_NAME .tm_clone_table
+#endif
+#endif
+


This, together with the unconditional use in varasm.c, will lead to a
bootstrap failure on Tru64 UNIX, which lacks named sections  
completely.


right, it was worrying me what a target without named sections does -
... I can easily remove the #if defined (TARGET_ASM_NAMED_SECTION)
... what happens when the code runs then?

Iain



Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Rainer Orth
Iain Sandoe develo...@sandoe-acoustics.co.uk writes:

 This, together with the unconditional use in varasm.c, will lead to a
 bootstrap failure on Tru64 UNIX, which lacks named sections completely.

 right, it was worrying me what a target without named sections does -
 ... I can easily remove the #if defined (TARGET_ASM_NAMED_SECTION)
 ... what happens when the code runs then?

We ICE like this:

/vol/gcc/src/hg/trunk/local/libitm/testsuite/libitm.c/cancel.c:55:1: internal
compiler error: in default_no_named_section, at varasm.c:6293

I should probably file a PR, but there's still no proper bugzilla
component for trans-mem.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Iain Sandoe


On 18 Nov 2011, at 18:12, Rainer Orth wrote:


Iain Sandoe develo...@sandoe-acoustics.co.uk writes:

This, together with the unconditional use in varasm.c, will lead  
to a
bootstrap failure on Tru64 UNIX, which lacks named sections  
completely.


right, it was worrying me what a target without named sections does -
... I can easily remove the #if defined (TARGET_ASM_NAMED_SECTION)
... what happens when the code runs then?


We ICE like this:

/vol/gcc/src/hg/trunk/local/libitm/testsuite/libitm.c/cancel.c:55:1:  
internal

compiler error: in default_no_named_section, at varasm.c:6293

I should probably file a PR, but there's still no proper bugzilla
component for trans-mem.


well ... what about this instead then?
Iain


Index: gcc/defaults.h
===
--- gcc/defaults.h  (revision 181476)
+++ gcc/defaults.h  (working copy)
@@ -392,6 +392,14 @@ see the files COPYING3 and COPYING.RUNTIME respect
 #endif
 #endif
 
+/* If we have named sections, provide a name for the transaction clone
+   table section.  */
+#if defined (TARGET_ASM_NAMED_SECTION)
+#ifndef TM_CLONE_TABLE_SECTION_NAME
+#define TM_CLONE_TABLE_SECTION_NAME .tm_clone_table
+#endif
+#endif
+
 /* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time.  */
Index: gcc/varasm.c
===
--- gcc/varasm.c(revision 181476)
+++ 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 defined (TARGET_ASM_NAMED_SECTION)
+ switch_to_section (get_named_section (NULL, 
+   TM_CLONE_TABLE_SECTION_NAME,
+   3));
+#else
+ switch_to_section (data_section);
+#endif
  assemble_align (POINTER_SIZE);
  switched = true;
}
Index: gcc/config/darwin.h
===
--- gcc/config/darwin.h (revision 181476)
+++ gcc/config/darwin.h (working copy)
@@ -692,6 +680,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  TM_CLONE_TABLE_SECTION_NAME
+#define 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
 




Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Rainer Orth
Iain Sandoe develo...@sandoe-acoustics.co.uk writes:

 well ... what about this instead then?

That one should at least be no worse than the current situation :-)

 Index: gcc/defaults.h
 ===
 --- gcc/defaults.h(revision 181476)
 +++ gcc/defaults.h(working copy)
 @@ -392,6 +392,14 @@ see the files COPYING3 and COPYING.RUNTIME respect
  #endif
  #endif
  
 +/* If we have named sections, provide a name for the transaction clone
 +   table section.  */
 +#if defined (TARGET_ASM_NAMED_SECTION)

I suggest using #ifdef for single-condition tests; it's less chatty and
thus easier to read (again below).

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [Patch] make it possible for the target to rename .tm_clone_table

2011-11-18 Thread Joseph S. Myers
On Fri, 18 Nov 2011, Iain Sandoe wrote:

   Index: gcc/defaults.h
   ===
   --- gcc/defaults.h(revision 181476)
   +++ gcc/defaults.h(working copy)
   @@ -392,6 +392,14 @@ see the files COPYING3 and COPYING.RUNTIME respect
   #endif
   #endif
   
   +/* If we have named sections, provide a name for the transaction clone
   +   table section.  */
   +#if defined (TARGET_ASM_NAMED_SECTION)
   +#ifndef TM_CLONE_TABLE_SECTION_NAME
   +#define TM_CLONE_TABLE_SECTION_NAME .tm_clone_table
   +#endif
   +#endif
   +
  
  This, together with the unconditional use in varasm.c, will lead to a
  bootstrap failure on Tru64 UNIX, which lacks named sections completely.
 
 right, it was worrying me what a target without named sections does -
 ... I can easily remove the #if defined (TARGET_ASM_NAMED_SECTION)
 ... what happens when the code runs then?

Conditions on definedness of TARGET_ASM_NAMED_SECTION are rather fragile - 
it's a target hook not properly a target macro, it shouldn't need to be 
defined in tm.h.  There are two such tests in defaults.h and two in 
target-def.h, but we should remove them rather than adding to them.  
TM_CLONE_TABLE_SECTION_NAME would better be a target hook, not a macro.

As I noted in http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01642.html 
(when cleaning up another such #ifdef conditional) there are actually very 
few targets without named sections.  And if we deprecate the a.out OpenBSD 
targets then there will be even fewer.

-- 
Joseph S. Myers
jos...@codesourcery.com