This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][Revised] Fix PR41313 by restoring original conditional logic for darwin
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- To: IainS <developer at sandoe-acoustics dot co dot uk>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Mike Stump <mrs at apple dot com>, Richard Henderson <rth at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Sat, 3 Oct 2009 15:40:57 -0400
- Subject: Re: [PATCH][Revised] Fix PR41313 by restoring original conditional logic for darwin
- References: <9276526E-A554-40E7-BCA3-7174EA38F341@sandoe-acoustics.co.uk>
On Sat, Oct 03, 2009 at 07:58:09PM +0100, IainS wrote:
> actually Jack,
>
> there's a wider issue here.
> the problem appears to be with the profile info generation/use.
>
> I also see a couple of fails on C at -m64 (darwin9)
>
> it only happens when there's a suitable .gcda file present.
>
> ==
>
> It is also on more than just one label emit - there are two sections of
> .eh data with duplicate labels but differing content.
>
> * If the culprit is likely to be darwin_emit_unwind_label() *
>
> Could some kind soul point me at some element in the DECL that would be a
> candidate for altering the label that's emitted?
>
> (at the moment the function just takes the DECL_ASSEMBLER_NAME, appends
> ".eh" and then globalizes it)
>
> the function checks for TREE_PUBLIC, and VISIBILITY
> it also checks for a WEAK_DECL.
>
> and finally, appends =0 for empty case.
>
> cheers,
> Iain
>
Iain,
See PR41313...specifically comment 12. If we take Jakub's approach of fixing
darwin_emit_unwind_label to properly generate different symbols for the hot/cold
partitions, it would appear that we would have to revise both default_emit_unwind_label()
and darwin_emit_unwind_label() to pass additional variables. I have taken a different
approach of returning darwin back to the previous behavior of not supporting hot/cold
partitioning on exceptions. This seems to work fine...
http://gcc.gnu.org/ml/gcc-testresults/2009-10/msg00331.html
The part that I am not having luck with yet is to also leverage the fact that
when targeting 10.6, we don't have to emit eh labels at all. However, I am having
problems wedging this into the existing code.
Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c (revision 152432)
+++ gcc/config/darwin.c (working copy)
@@ -1697,6 +1697,10 @@
if (dwarf_strict < 0)
dwarf_strict = 1;
+ /* Disable .eh labels when targeting >=10.6 to allow -freorder-blocks-and-partition. */
+ if (darwin_macosx_version_min && strverscmp (darwin_macosx_version_min, "10.6") >= 0)
+ targetm.asm_out.unwind_label = default_emit_unwind_label;
+
if (flag_mkernel || flag_apple_kext)
{
/* -mkernel implies -fapple-kext for C++ */
seems insufficient to cause the conditionals...
Index: opts.c
===================================================================
--- opts.c (revision 152432)
+++ opts.c (working copy)
@@ -1039,6 +1039,7 @@
if (flag_exceptions && flag_reorder_blocks_and_partition
&& (USING_SJLJ_EXCEPTIONS
+ || (targetm.asm_out.unwind_label != default_emit_unwind_label)
#ifdef TARGET_UNWIND_INFO
|| 1
#endif
@@ -1056,6 +1057,7 @@
if (flag_unwind_tables && ! targetm.unwind_tables_default
&& flag_reorder_blocks_and_partition
&& (USING_SJLJ_EXCEPTIONS
+ || (targetm.asm_out.unwind_label != default_emit_unwind_label)
#ifdef TARGET_UNWIND_INFO
|| 1
#endif
@@ -1075,6 +1077,7 @@
&& (!targetm.have_named_sections
|| (flag_unwind_tables && targetm.unwind_tables_default
&& (USING_SJLJ_EXCEPTIONS
+ || (targetm.asm_out.unwind_label != default_emit_unwind_label)
#ifdef TARGET_UNWIND_INFO
|| 1
#endif
to come up false (ie targetm.asm_out.unwind_label = default_emit_unwind_label
when -mmacosx-version-min=10.6. I am very unclear on the exact relationship of
the preprocessor define for TARGET_ASM_EMIT_UNWIND_LABEL and when and how
exactly targetm.asm_out.unwind_label is set to that value.
Jakub, do you have any comments on how we might effectively reset targetm.asm_out.unwind_label
on the fly? I am attempting to have the compiler, when building for the 10.6 target,
defaults to targetm.asm_out.unwind_label as default_emit_unwind_label but
targeting <10.6, have default_emit_unwind_label set to darwin_emit_unwind_label?
Jack