From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1906 invoked by alias); 5 Jul 2013 13:51:32 -0000 Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org Received: (qmail 1865 invoked by uid 89); 5 Jul 2013 13:51:26 -0000 X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_GC,TW_IB autolearn=ham version=3.3.1 Received: from bromo.med.uc.edu (HELO bromo.med.uc.edu) (129.137.3.146) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 05 Jul 2013 13:51:25 +0000 Received: from bromo.med.uc.edu (localhost.localdomain [127.0.0.1]) by bromo.med.uc.edu (Postfix) with ESMTP id 6916FB2DBB; Fri, 5 Jul 2013 09:51:23 -0400 (EDT) Received: (from howarth@localhost) by bromo.med.uc.edu (8.14.3/8.14.3/Submit) id r65DpMCM027330; Fri, 5 Jul 2013 09:51:22 -0400 Date: Fri, 05 Jul 2013 13:51:00 -0000 From: Jack Howarth To: java@gcc.gnu.org Cc: per@bothner.com, aph@redhat.com, tromey@redhat.com Subject: [PATCH] link libgcj directly to libiconv to resolve symbols Message-ID: <20130705135122.GA10261@bromo.med.uc.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="T4sUOijqQbZv57TR" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Found: No X-SW-Source: 2013-07/txt/msg00007.txt.bz2 --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 868 Currently the build of the libgcj shared library in libjava omits a direct linkage against the libiconv shared library to resolve the undefined _libiconv, _libiconv_close and _libiconv_open symbols in libgcj. My understanding of shared library best practices is that shared libraries should always be linked directly to the those shared libraries required to resolve their undefined symbols rather than postponing this linkage until when the shared library is used (as is currently done in libjava/libgcj.spec.in). The attached patch achieves this by removing the @LIBMATHSPEC@ from *lib: in libjava/libgcj.spec.in and moving it as $(LDLIBICONV) onto libgcj_la_LDFLAGS in libjava/Makefile.am and libjava/Makefile.in. Bootstrap and regression tested on x86_64-apple-darwin12 for gcc trunk and gcc-4_8-branch. Okay for gcc trunk and gcc-4_8-branch? Jack --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="link_libgcj_to_libiconv.diff" Content-length: 2336 2013-07-05 Jack Howarth libjava/ PR java/49441 * libgcj.spec.in (*lib:): Remove @LDLIBICONV@. * Makefile.am (libgcj_la_LDFLAGS): Add $(LDLIBICONV). * Makefile.in (libgcj_la_LDFLAGS): Regenerated. Index: libjava/libgcj.spec.in =================================================================== --- libjava/libgcj.spec.in (revision 200713) +++ libjava/libgcj.spec.in (working copy) @@ -7,6 +7,6 @@ *startfile: @THREADSTARTFILESPEC@ %(startfileorig) %rename lib liborig -*lib: @LD_START_STATIC_SPEC@ @LIBGCJ_SPEC@ @LD_FINISH_STATIC_SPEC@ @LIBMATHSPEC@ @LDLIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) @LIBSTDCXXSPEC@ %(liborig) +*lib: @LD_START_STATIC_SPEC@ @LIBGCJ_SPEC@ @LD_FINISH_STATIC_SPEC@ @LIBMATHSPEC@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) @LIBSTDCXXSPEC@ %(liborig) *jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ @ATOMICSPEC@ @LIBGCJ_BC_SPEC@ -fkeep-inline-functions Index: libjava/Makefile.am =================================================================== --- libjava/Makefile.am (revision 200713) +++ libjava/Makefile.am (working copy) @@ -492,7 +492,7 @@ xlib_nat_files = $(xlib_nat_source_files libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \ $(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \ -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL) + $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL) $(LDLIBICONV) libgcj_la_LIBADD = \ classpath/native/fdlibm/libfdlibm.la \ java/lang/Object.lo \ Index: configure =================================================================== --- configure (revision 200713) +++ configure (working copy) @@ -7416,6 +7416,13 @@ if test x${is_cross_compiler} = xyes ; t target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}" fi +# Pass --with-sysroot on darwin without SDK in / +case "${target}" in + x86_64-*-darwin1[3-9]*) + host_configargs="--with-sysroot=\"`xcrun --show-sdk-path`\" ${host_configargs}" + ;; +esac + # Default to --enable-multilib. if test x${enable_multilib} = x ; then target_configargs="--enable-multilib ${target_configargs}" --T4sUOijqQbZv57TR--