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]

[build] Handle -rdynamic on Solaris 2 with GNU ld


When comparing testsuite results on Solaris 11/x86 with Sun ld vs. GNU
ld, I noticed that plugin support was disabled with GNU ld.  It turned
out that this happens since gld needs --export-dynamic to implement
-rdynamic, while with Sun ld, -rdynamic is a no-op.

The following trivial patch fixes this.  While testing it, I noticed
that the -rdynamic test in gcc/configure.ac didn't log its result, so I
fixed this at the same time.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.

Ok for mainline, though the configure.ac part is probably obvious?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2010-02-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (plugin -rdynamic test): Log result.
	* configure: Regenerate.
	* config/sol2.h (LINK_SPEC): Handle -rdynamic.
	(RDYNAMIC_SPEC): Define.
	* config/sol2-gld.h (RDYNAMIC_SPEC): Redefine.

diff -r 667aff96a538 gcc/config/sol2-gld.h
--- a/gcc/config/sol2-gld.h	Mon Mar 22 20:55:55 2010 +0100
+++ b/gcc/config/sol2-gld.h	Mon Mar 22 20:56:30 2010 +0100
@@ -25,3 +25,7 @@
 
 #undef SUPPORTS_INIT_PRIORITY
 #define SUPPORTS_INIT_PRIORITY 1
+
+/* GNU ld needs --export-dynamic to implement -rdynamic.  */
+#undef RDYNAMIC_SPEC
+#define RDYNAMIC_SPEC "--export-dynamic"
diff -r 667aff96a538 gcc/config/sol2.h
--- a/gcc/config/sol2.h	Mon Mar 22 20:55:55 2010 +0100
+++ b/gcc/config/sol2.h	Mon Mar 22 20:56:30 2010 +0100
@@ -174,12 +174,16 @@
 #define LINK_SPEC \
   "%{h*} %{v:-V} \
    %{b} \
+   %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
    %{static:-dn -Bstatic} \
    %{shared:-G -dy %{!mimpure-text:-z text}} \
    %{symbolic:-Bsymbolic -G -dy -z text} \
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"
 
+/* With Sun ld, -rdynamic is a no-op.  */
+#define RDYNAMIC_SPEC ""
+
 /* The Solaris linker doesn't understand constructor priorities.  (The
    GNU linker does support constructor priorities, so GNU ld
    configuration files for Solaris override this setting.)  */
--- a/gcc/configure.ac	Mon Mar 22 20:55:55 2010 +0100
+++ b/gcc/configure.ac	Mon Mar 22 20:56:30 2010 +0100
@@ -4420,10 +4420,13 @@
     AC_MSG_CHECKING([for -rdynamic])
     ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest > /dev/null 2>&1
     if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
+      plugin_rdynamic=yes
       pluginlibs="-rdynamic"
     else
+      plugin_rdynamic=no
       enable_plugin=no
     fi
+    AC_MSG_RESULT([$plugin_rdynamic])
   fi
 
   # Check -ldl


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