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]

PATCH: Support visibility attribute with recent Sun ld


Prompted by a thread on the OpenSolaris tools-compilers list about lack of
.hidden support in GCC

	http://mail.opensolaris.org/pipermail/tools-compilers/2008-October/000407.html

I've implemented the following trivial patch to support the visibility
attribute with Sun ld on Solaris 9 and up.  If anyone can devise a proper
test, it may even be enabled on Solaris 8 with the appropriate patch, but
until that time I prefer to err on the side of caution.

I've tested it by a full bootstrap (all languages) on sparc-sun-solaris2.11
with /usr/ccs/bin/as (still running) and i386-pc-solaris2.10 with gas 2.15
(/usr/sfw/bin/gas) and verified that there are no testsuite regressions.
As expected, all visibility tests in the gcc and g++ testsuites (which were
previously UNSUPPORTED) PASS now.

There's one regression in the the 32-bit libjava testsuite:

+FAIL: events output

but that seems spurious: rerunning the testcase manually gives results
different from both the expected output and the previous automatic run.
Here's the difference during the automatic run:

--- /vol/gcc/src/gcc-dist/libjava/testsuite/libjava.jvmti/events.out    Tue Mar 
13 01:25:31 2007
+++ events.out  Thu Oct 30 19:22:23 2008
@@ -4,7 +4,7 @@
 created JVMTI environment #1
 created JVMTI environment #2
 setting callbacks for envs
-RequestedEvents: 
+RequestedEvents: VMInit,
 enable VM_INIT for env0, env1, env2
 RequestedEvents: VMInit,
 enable VM_DEATH for env1,env2

Given this variability, this seems spurious to me and unrelated to the
patch at hand.

Ok for mainline if SPARC testing passes as well?

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
 

Thu Oct 30 12:19:59 2008  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* configure.ac (gcc_cv_ld_hidden): Sun ld on Solaris 9 and up
	supports hidden.
	* configure: Regenerate.
	
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 141412)
+++ gcc/configure.ac	(working copy)
@@ -2101,10 +2101,10 @@ AC_CACHE_CHECK(linker for .hidden suppor
      gcc_cv_ld_hidden=yes
   fi
 else
+changequote(,)dnl
   gcc_cv_ld_hidden=yes
   ld_ver=`$gcc_cv_ld --version 2>/dev/null | sed 1q`
   if echo "$ld_ver" | grep GNU > /dev/null; then
-changequote(,)dnl
     ld_vers=`echo $ld_ver | sed -n \
 	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*.*\)$,\1,p'`
     ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
@@ -2128,18 +2128,21 @@ changequote(,)dnl
 	  gcc_cv_ld_hidden=no
 	fi
       fi
-changequote([,])dnl
     fi
   else
     case "${target}" in
       hppa64*-*-hpux* | ia64*-*-hpux*)
 	gcc_cv_ld_hidden=yes
 	;;
+      *-*-solaris2.9* | *-*-solaris2.1[0-9]*)
+        gcc_cv_ld_hidden=yes
+	;;
       *)
 	gcc_cv_ld_hidden=no
 	;;
     esac
   fi
+changequote([,])dnl
 fi])
 libgcc_visibility=no
 AC_SUBST(libgcc_visibility)


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