This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

[BC] Link libs with -Bsymbolic


If you have multiple versions of the same class loaded in separate
shared objects, Bad Things happen with symbol resolution due to shared
library loader rules.

-Bsymbolic causes the linker to resolve as many symbols as possible at
link time, so references from a class to its indirection table (for
example) are not resolved to a separate shared object.  This has the
additional advantage of making loading faster.

We can't make all these symbols private because CNI programs need
access to them, at least for the time being.


However, some issues:

Is this possible on non-GNU operating systems?
Should we always use -Bsymbolic when making a shared lib?

If the answer to ii. is "yes", we can probe for -Bsymbolic with
autoconf and put it into libgcj.spec when linking: we won't need it
explicitly in Makefile.am.

Andrew.


	* Makefile.am: Use -Wl,-Bsymbolic for all shared libraries
          except libgcj itself.
	* Makefile.in: regenerated.
	 
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.368.2.8
diff -u -r1.368.2.8 Makefile.am
--- Makefile.am 5 Nov 2004 13:57:48 -0000       1.368.2.8
+++ Makefile.am 15 Nov 2004 14:10:01 -0000
@@ -351,7 +351,7 @@
 lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES = $(gtk_jni_headers) libgcj-@gcc_version@.jar libgcj.la libgcj.spec
 ## The mysterious backslash in the grep pattern is consumed by make.
 lib_gnu_java_awt_peer_gtk_la_LDFLAGS = \
-        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+        -version-info `grep -v '^\#' $(srcdir)/libtool-version` -Wl,-Bsymbolic
 lib_gnu_java_awt_peer_gtk_la_LINK = $(LIBLINK)
 
 lib_org_ietf_jgss_la_SOURCES = \
@@ -372,7 +372,7 @@
 
 ## The mysterious backslash in the grep pattern is consumed by make.
 lib_org_ietf_jgss_la_LDFLAGS = -rpath $(toolexeclibdir) \
-       -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+       -version-info `grep -v '^\#' $(srcdir)/libtool-version` -Wl,-Bsymbolic
 
 lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
 org/w3c/dom/CDATASection.java \
@@ -403,7 +403,7 @@
 lib_org_w3c_dom_la_LIBADD = -L$(here)/.libs libgcj.la
 ## The mysterious backslash in the grep pattern is consumed by make.
 lib_org_w3c_dom_la_LDFLAGS = -rpath $(toolexeclibdir) \
-        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+        -version-info `grep -v '^\#' $(srcdir)/libtool-version` -Wl,-Bsymbolic
 
 lib_org_xml_sax_la_SOURCES = org/xml/sax/ext/DeclHandler.java \
 org/xml/sax/ext/LexicalHandler.java \
@@ -439,7 +439,7 @@
 lib_org_xml_sax_la_LIBADD = -L$(here)/.libs libgcj.la
 ## The mysterious backslash in the grep pattern is consumed by make.
 lib_org_xml_sax_la_LDFLAGS = -rpath $(toolexeclibdir) \
-        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+        -version-info `grep -v '^\#' $(srcdir)/libtool-version` -Wl,-Bsymbolic
 
 lib_gnu_awt_xlib_la_SOURCES = \
        $(xlib_java_source_files) \
@@ -455,7 +455,7 @@
 lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
        @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
         -rpath $(toolexeclibdir) \
-        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+        -version-info `grep -v '^\#' $(srcdir)/libtool-version` -Wl,-Bsymbolic
 lib_gnu_awt_xlib_la_LINK = $(LIBLINK)
 
 all_java_source_files = \


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