Re: [RFC PATCH] make libgcj_bc prims symbol sizes correct

Andrew Haley <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
This is what I went with.  On all systems which can use libgcj_bc,
Linux/{Free,Net,Open}BSD/Hurd and perhaps few others, USE_LIBGCJ_BC
is set.  In that case, we add

  %{findirect-dispatch:-fPIC}

to libgcj.spec, which causes all BC-compiled programs to be linked PIC.
PIC-compiled executables don't have copy relocs and do not depend on
symbols like _Jv_intClass having any particular size.

Please let me know if this works for you.

Andrew.


2009-08-17  Andrew Haley  <[email protected]>

	* Makefile.am (libgcj_bc_la_LIBADD): Delete.
	* libgcj.spec.in: (LIBGCJ_BC_SPEC): New spec.
	* configure.ac (LIBGCJ_BC_SPEC): New spec.


Index: configure.ac
===================================================================
--- configure.ac	(revision 150834)
+++ configure.ac	(working copy)
@@ -1078,8 +1078,10 @@
 LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
 if test "$use_libgcj_bc" = yes; then
   LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:-lgcj;:-lgcj_bc}"
+  LIBGCJ_BC_SPEC="%{findirect-dispatch:-fPIC}"
 fi
 AC_SUBST(LIBGCJ_SPEC)
+AC_SUBST(LIBGCJ_BC_SPEC)

 HASH_SYNC_SPEC=
 # Hash synchronization is only useful with posix threads right now.
Index: libgcj.spec.in
===================================================================
--- libgcj.spec.in	(revision 150834)
+++ libgcj.spec.in	(working copy)
@@ -9,4 +9,4 @@
 %rename lib liborig
 *lib: @LD_START_STATIC_SPEC@ @LIBGCJ_SPEC@ @LD_FINISH_STATIC_SPEC@ -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) @LIBSTDCXXSPEC@ %(liborig)

-*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ @ATOMICSPEC@ -fkeep-inline-functions
+*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ @ATOMICSPEC@ @LIBGCJ_BC_SPEC@ -fkeep-inline-functions
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 150834)
+++ Makefile.am	(working copy)
@@ -358,10 +358,10 @@
 ## Support for libgcj_bc: dummy shared library.
 ##
 ## This lets us have one soname in BC objects and another in C++ ABI objects.
+## This library is not linked against libgcj.
 libgcj_bc_la_SOURCES = libgcj_bc.c
 libgcj_bc_la_LDFLAGS = -rpath $(toolexeclibdir) -no-static -version-info 1:0:0 \
 	$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
-libgcj_bc_la_LIBADD = libgcj.la
 libgcj_bc_la_DEPENDENCIES = libgcj.la
 libgcj_bc_la_LINK = $(LIBLINK)
 ## This is specific to Linux/{Free,Net,Open}BSD/Hurd and perhaps few others.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.