PATCH: Fix Solaris init-priority problems

Mark Mitchell mark@codesourcery.com
Tue Feb 27 17:30:00 GMT 2007


This is the patch for the problem that Kaveh reported (and debugged!)
with Solaris initialization priority.  When building with the Solaris
linker (instead of GNU ld), GCC doesn't support initialization
priorities, but the target-supports.exp code didn't detect that case
because the C front end didn't actually issue an error about use of
priorities.

This patch makes the priority code issue an error on targets that
don't support priorities, and removes the Solaris-specific hack in
check_effective_target_init_priority.  So, we should now be strictly
better off than we were before this series of patches on Solaris, in
that Solaris ld users now get UNSUPPORTED (instead of XFAIL) and GNU
ld users now get PASS (instead of XPASS) for the C++ initialization
priority tests.

Tested on x86_64-unknown-linux-gnu, after Kaveh did some spot tests on
Solaris, applied to mainline.

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2007-02-27  Mark Mitchell  <mark@codesourcery.com>

	* c-common.c (get_priority): Add check for
	SUPPORTS_INIT_PRIORITY.

2007-02-27  Mark Mitchell  <mark@codesourcery.com>

	* lib/target-supports.exp (check_effective_target_init_priority):
	Remove Solaris special case.

Index: c-common.c
===================================================================
--- c-common.c	(revision 122341)
+++ c-common.c	(working copy)
@@ -4697,6 +4697,15 @@ get_priority (tree args, bool is_destruc
   if (!args)
     return DEFAULT_INIT_PRIORITY;
   
+  if (!SUPPORTS_INIT_PRIORITY)
+    {
+      if (is_destructor)
+	error ("destructor priorities are not supported");
+      else
+	error ("constructor priorities are not supported");
+      return DEFAULT_INIT_PRIORITY;
+    }
+
   arg = TREE_VALUE (args);
   if (!host_integerp (arg, /*pos=*/0)
       || !INTEGRAL_TYPE_P (TREE_TYPE (arg)))
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp	(revision 122334)
+++ testsuite/lib/target-supports.exp	(working copy)
@@ -2093,13 +2093,6 @@ proc check_effective_target_dummy_wcsfti
 # supposed on this target.
 
 proc check_effective_target_init_priority {} {
-    # On Solaris2, initialization priorities are only supported with
-    # GNU ld, but the compiler accepts them even when using Sun ld.
-    # For more information, see PR 6482.
-    if { [istarget *-solaris2*] } {
-	return 1
-    }
-
     return [check_no_compiler_messages init_priority assembly "
 	void f() __attribute__((constructor (1000)));
 	void f() \{\}



More information about the Gcc-patches mailing list