This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to check_visibility_available


On Thu, 18 Nov 2004, Janis Johnson wrote:

> Please use the new proc get_compiler_messages to compile the testcase.
> It takes care of things like making sure the file names are unique so
> that a check from the gcc tests won't clobber files from a simultaneous
> check from the g++ tests.  Richard Sandiford, who added that proc,
> modified check_named_sections_available to use it.

This patch is revised as requested.

No testsuite regressions with this patch on i386-pc-solaris2.10.  OK
to commit?

2004-11-19  Mark Mitchell  <mark@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* lib/target-supports.exp (check_visibility_available): Really
	test the compiler.

diff -rupN -x CVS gcc-merge-HEAD-csl-sol210-1/gcc/testsuite/lib/target-supports.exp gcc-sol210/gcc/testsuite/lib/target-supports.exp
--- gcc-merge-HEAD-csl-sol210-1/gcc/testsuite/lib/target-supports.exp	2004-09-03 11:09:34.000000000 -0700
+++ gcc-sol210/gcc/testsuite/lib/target-supports.exp	2004-09-27 08:45:15.000000000 -0700
@@ -97,30 +97,30 @@
 ###############################
 
 # The visibility attribute is only support in some object formats
-# This proc returns 1 if it is supported, 0 if not, -1 if unsure.
+# This proc returns 1 if it is supported, 0 if not.
 
 proc check_visibility_available { } {
+    global visibility_available_saved
+    global tool
     global target_triplet
-    global target_cpu
 
     # On NetWare, support makes no sense.
-    
     if { [string match "*-*-netware*" $target_triplet] } {
         return 0
     }
 
-    # ELF supports it if the system has recent GNU ld and gas.
-    # As a start we return 1 for all ELF systems; we'll let people
-    # add exceptions as necessary.
-
-    set objformat [gcc_target_object_format]
-
-    switch $objformat {
-        elf      { return 1 }
-        mach-o   { return 1 }
-        unknown  { return -1 }
-        default  { return 0 }
+    if {![info exists visibility_available_saved] } {
+	set lines [get_compiler_messages visibility object {
+	    void f() __attribute__((visibility("hidden")));
+	    void f() {}
+	}]
+	if [string match "" $lines] then {
+	    set visibility_available_saved 1
+	} else {
+	    set visibility_available_saved 0
+	}
     }
+    return $visibility_available_saved
 }
 
 ###############################

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]