Patchwork Enable SUPPORTS_INIT_PRIORITY on darwin

login
register
mail settings
Submitter Jack Howarth
Date Feb. 5, 2013, 2:30 p.m.
Message ID <20130205143048.GA30050@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/218265/
State New
Headers show

Comments

Jack Howarth - Feb. 5, 2013, 2:30 p.m.
Once the requested patch to extend qsorting of init priorities to destructors...

http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00154.html

is committed, the following patch enables SUPPORTS_INIT_PRIORITY on darwin. The
testsuite regression results are...

http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00520.html

without and...

http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00522.html

with SUPPORTS_INIT_PRIORITY enabled. Only the g++.dg/special/conpr-3.C execution test
fails as expected. The attached patch adds a dg-shouldfail on darwin for this testcase
as darwin lacks inter-module init priority support. With this patch, we will have the
same level of init priority support (ie only intra-modular) as clang. Regression tested
on x86_64-apple-darwin12. Okay for gcc trunk after the destructor qsorting patch
is committed?
        Jack
/gcc

2013-02-05  Jack Howarth  <howarth@bromo.med.uc.edu>

	* gcc/config/darwin.h: Enable SUPPORTS_INIT_PRIORITY.

/gcc/testsuite

2013-02-05  Jack Howarth  <howarth@bromo.med.uc.edu>

	* g++.dg/special/conpr-3.C: Add dg-shouldfail on *-apple-darwin*.
Jack Howarth - Feb. 5, 2013, 6:48 p.m.
On Tue, Feb 05, 2013 at 09:30:48AM -0500, Jack Howarth wrote:
>    Once the requested patch to extend qsorting of init priorities to destructors...
> 
> http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00154.html
> 
> is committed, the following patch enables SUPPORTS_INIT_PRIORITY on darwin. The
> testsuite regression results are...
> 
> http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00520.html
> 
> without and...
> 
> http://gcc.gnu.org/ml/gcc-testresults/2013-02/msg00522.html
> 
> with SUPPORTS_INIT_PRIORITY enabled. Only the g++.dg/special/conpr-3.C execution test
> fails as expected. The attached patch adds a dg-shouldfail on darwin for this testcase
> as darwin lacks inter-module init priority support. With this patch, we will have the
> same level of init priority support (ie only intra-modular) as clang. Regression tested
> on x86_64-apple-darwin12. Okay for gcc trunk after the destructor qsorting patch
> is committed?
>         Jack

Mike,
    I can confirm that we are able to work around lack of inter-module priority
support on darwin...

% g++-fsf-4.8 conpr-3.C conpr-3a.cc conpr-3b.cc
% ./a.out
Abort

by compiling with LTO...

% g++-fsf-4.8 -flto conpr-3.C conpr-3a.cc conpr-3b.cc
% ./a.out
%

Nice.
          Jack



> /gcc
> 
> 2013-02-05  Jack Howarth  <howarth@bromo.med.uc.edu>
> 
> 	* gcc/config/darwin.h: Enable SUPPORTS_INIT_PRIORITY.
> 
> /gcc/testsuite
> 
> 2013-02-05  Jack Howarth  <howarth@bromo.med.uc.edu>
> 
> 	* g++.dg/special/conpr-3.C: Add dg-shouldfail on *-apple-darwin*.
> 
> Index: gcc/testsuite/g++.dg/special/conpr-3.C
> ===================================================================
> --- gcc/testsuite/g++.dg/special/conpr-3.C	(revision 195747)
> +++ gcc/testsuite/g++.dg/special/conpr-3.C	(working copy)
> @@ -1,5 +1,6 @@
>  /* { dg-do run { target init_priority } } */
>  /* { dg-additional-sources "conpr-3a.cc conpr-3b.cc" } */
> +/* { dg-shouldfail "No inter-module priority support" { *-apple-darwin* } } */
>  
>  #include <stdlib.h>
>  
> Index: gcc/config/darwin.h
> ===================================================================
> --- gcc/config/darwin.h	(revision 195747)
> +++ gcc/config/darwin.h	(working copy)
> @@ -912,9 +912,8 @@ extern void darwin_driver_init (unsigned
>    darwin_driver_init (&decoded_options_count, &decoded_options)
>  #endif
>  
> -/* The Apple assembler and linker do not support constructor priorities.  */
> -#undef SUPPORTS_INIT_PRIORITY
> -#define SUPPORTS_INIT_PRIORITY 0
> +/* While the Apple assembler and linker do not support constructor priorities,
> +   intra-module priority support is available through sort_cdtor_records. */
>  
>  /* When building cross-compilers (and native crosses) we shall default to 
>     providing an osx-version-min of this unless overridden by the User.  */

Patch

Index: gcc/testsuite/g++.dg/special/conpr-3.C
===================================================================
--- gcc/testsuite/g++.dg/special/conpr-3.C	(revision 195747)
+++ gcc/testsuite/g++.dg/special/conpr-3.C	(working copy)
@@ -1,5 +1,6 @@ 
 /* { dg-do run { target init_priority } } */
 /* { dg-additional-sources "conpr-3a.cc conpr-3b.cc" } */
+/* { dg-shouldfail "No inter-module priority support" { *-apple-darwin* } } */
 
 #include <stdlib.h>
 
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 195747)
+++ gcc/config/darwin.h	(working copy)
@@ -912,9 +912,8 @@  extern void darwin_driver_init (unsigned
   darwin_driver_init (&decoded_options_count, &decoded_options)
 #endif
 
-/* The Apple assembler and linker do not support constructor priorities.  */
-#undef SUPPORTS_INIT_PRIORITY
-#define SUPPORTS_INIT_PRIORITY 0
+/* While the Apple assembler and linker do not support constructor priorities,
+   intra-module priority support is available through sort_cdtor_records. */
 
 /* When building cross-compilers (and native crosses) we shall default to 
    providing an osx-version-min of this unless overridden by the User.  */