diff mbox

replace hardcoded -lm in libgcj.spec.in for darwin

Message ID 20100818142349.GA30217@bromo.med.uc.edu
State New
Headers show

Commit Message

Jack Howarth Aug. 18, 2010, 2:23 p.m. UTC
The attached patch replaces the hard-coded -lm in libjava/libgcj.spec.in
with the contents of LIBMATHSPEC as conditionally defined in configure.ac.
Bootstrapped and regression tested on x86_64-apple-darwin10. Okay for gcc
trunk?
              Jack
ps Before this patch "gcj --main=testme -O testme.java" produced...

	/sw/lib/gcc4.6/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/sw/lib/gcc4.6/lib/libgcj.12.dylib (compatibility version 13.0.0, current version 13.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
	/sw/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)

whereas with the patch libSystem properly appears last...

	/sw/lib/gcc4.6/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/sw/lib/gcc4.6/lib/libgcj.12.dylib (compatibility version 13.0.0, current version 13.0.0)
	/sw/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)

The separation of /sw/lib/gcc4.6/lib/libgcc_s.1.dylib and /usr/lib/libSystem.B.dylib in the linkage
order appears due to the duplicate -lgcc_ext.10.5 occurances in the linkage as a result of -shared-libgcc...

COLLECT_GCC_OPTIONS= '-mmacosx-version-min=10.6.5' '-v' '-O'  '-shared-libgcc' '-mtune=generic'
 /sw/lib/gcc4.6/libexec/gcc/x86_64-apple-darwin10.5.0/4.6.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.5 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.5.o -L/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin10.5.0/4.6.0 -L/sw/lib/gcc4.6/lib/gcc/x86_64-apple-darwin10.5.0/4.6.0/../../.. /var/tmp//cclJxmz2.o /var/tmp//ccKe7aS5.o -lgcc_ext.10.5 -lgcj -L/sw/lib -liconv -lz -allow_stack_execute -lgcc_ext.10.5 -lSystem


2010-08-18  Jack Howarth <howarth@bromo.med.uc.edu>

	* libjava/configure.ac: Set LIBMATHSPEC to -lm except on darwin.
	* libjava/libgcj.spec.in: Use LIBMATHSPEC.
	* libjava/configure: Regenerate.
	* libjava/Makefile.in: Likewise.
	* libjava/include/Makefile.in: Likewise.
	* libjava/testsuite/Makefile.in: Likewise.
	* libjava/gcj/Makefile.in: Likewise.

Comments

Andrew Haley Aug. 18, 2010, 6:04 p.m. UTC | #1
On 08/18/2010 03:23 PM, Jack Howarth wrote:
>   The attached patch replaces the hard-coded -lm in libjava/libgcj.spec.in
> with the contents of LIBMATHSPEC as conditionally defined in configure.ac.
> Bootstrapped and regression tested on x86_64-apple-darwin10. Okay for gcc
> trunk?

I guess so, but it seems like a lot of pain.  Oh well...

Andrew.
Iain Sandoe Sept. 21, 2010, 2:03 p.m. UTC | #2
On 18 Aug 2010, at 19:04, Andrew Haley wrote:

> On 08/18/2010 03:23 PM, Jack Howarth wrote:
>>  The attached patch replaces the hard-coded -lm in libjava/ 
>> libgcj.spec.in
>> with the contents of LIBMATHSPEC as conditionally defined in  
>> configure.ac.
>> Bootstrapped and regression tested on x86_64-apple-darwin10. Okay  
>> for gcc
>> trunk?
>
> I guess so, but it seems like a lot of pain.  Oh well...

r164478
Iain
diff mbox

Patch

Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 163335)
+++ libjava/configure.ac	(working copy)
@@ -928,6 +928,16 @@ 
     ;;
 esac
 
+LIBMATHSPEC=
+# extra LD Flags which are required for targets
+case "${host}" in
+*-*-darwin*)
+     ;;
+*)
+     LIBMATHSPEC=-lm
+     ;;
+esac
+
 # Check for --no-merge-exidx-entries, an ARM-specific linker option.
 AC_CACHE_CHECK([for --no-merge-exidx-entries], [libgcj_cv_exidx],
   [saved_ldflags="$LDFLAGS"
@@ -953,6 +963,7 @@ 
 AC_SUBST(extra_ldflags_libjava)
 AC_SUBST(extra_ldflags)
 AC_SUBST(LIBSTDCXXSPEC)
+AC_SUBST(LIBMATHSPEC)
 
 AC_SUBST(LIBGCJTESTSPEC)
 
Index: libjava/libgcj.spec.in
===================================================================
--- libjava/libgcj.spec.in	(revision 163335)
+++ 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@ -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) @LIBSTDCXXSPEC@ %(liborig)
+*lib: @LD_START_STATIC_SPEC@ @LIBGCJ_SPEC@ @LD_FINISH_STATIC_SPEC@ @LIBMATHSPEC@ @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) @LIBSTDCXXSPEC@ %(liborig)
 
 *jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ @ATOMICSPEC@ @LIBGCJ_BC_SPEC@ -fkeep-inline-functions