Delivered-To: listarch-gcc-patches at gcc dot gnu dot org Received: (qmail 27356 invoked by alias); 7 Oct 2008 18:11:15 -0000 Received: (qmail 27347 invoked by uid 22791); 7 Oct 2008 18:11:13 -0000 X-Spam-Check-By: sourceware.org Received: from fg-out-1718.google.com (HELO fg-out-1718.google.com) (72.14.220.154) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 07 Oct 2008 18:10:20 +0000 Received: by fg-out-1718.google.com with SMTP id e21so2412591fga.28 for ; Tue, 07 Oct 2008 11:10:15 -0700 (PDT) Received: by 10.181.25.18 with SMTP id c18mr5278303bkj.61.1223403015435; Tue, 07 Oct 2008 11:10:15 -0700 (PDT) Received: from s42.loc (85-127-249-102.dynamic.xdsl-line.inode.at [85.127.249.102]) by mx.google.com with ESMTPS id b17sm14173957fka.7.2008.10.07.11.10.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 07 Oct 2008 11:10:14 -0700 (PDT) Received: from cow by s42.loc with local (Exim 4.69) (envelope-from ) id 1KnH0l-00050F-7O; Tue, 07 Oct 2008 20:10:19 +0200 Date: Tue, 7 Oct 2008 20:10:19 +0200 From: Bernhard Reutner-Fischer To: Ian Lance Taylor Cc: gcc-patches at gcc dot gnu dot org Subject: Re: [PATCH] link libgcc_s.so against a lib containing copysignl on powerpc-*-linux-uclibc Message-ID: <20081007181019.GB5178@mx.loc> References: <20081007141721.GG9250@mx.loc> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="rwEMma7ioTxnRzrJ" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner at gcc dot gnu dot org Delivered-To: mailing list gcc-patches at gcc dot gnu dot org --rwEMma7ioTxnRzrJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 07, 2008 at 09:39:31AM -0700, Ian Lance Taylor wrote: >Bernhard Reutner-Fischer writes: > >> gcc/ChangeLog: >> >> 2008-10-07 Bernhard Reutner-Fischer <> >> >> * config/t-slibgcc-elf-ver (SHLIB_LC): Also link against >> @libgcc_libm@. >> >> libgcc/ChangeLog: >> >> 2008-10-07 Bernhard Reutner-Fischer <> >> >> * configure.ac (libgcc_cv_copysignl_lib, LIBGCC_LIBM): New >> variables to denote if we are on powerpc-uclibc where libm >> functions live in libm. >> * Makefile.in (LIBGCC_LIBM): Set. >> (libgcc_s$(SHLIB_EXT)): Substitute @libgcc_libm@ with >> $(LIBGCC_LIBM). >> * (configure): Regenerate. > > >> +# On powerpc libgcc_s references copysignl which is a libm function but >> +# glibc apparently also provides it via libc as opposed to uClibc where >> +# it lives in libm. >> +dnl save_LIBS="$LIBS" >> +dnl LIBS= >> +dnl AC_SEARCH_LIBS(copysignl, m) >> +dnl LIBGCC_LIBS="$LIBS" >> +dnl LIBS="$save_LIBS" >> +dnl AC_SUBST(LIBGCC_LIBS) > >Why don't you run these commands listed as dnl? I don't have a working compiler here yet and GCC_NO_EXECUTABLES. I can only assemble, not link (we're about to build the libgcc for the compiler here). > >> +AC_CACHE_CHECK([for library containing copysignl], >> + libgcc_cv_copysignl_lib, [ >> + echo '#include ' > conftest.c >> + case $target_alias in >> + *powerpc*) >> + echo 'int the_libc = __UCLIBC__;' >> conftest.c >> + ;; >> + *) >> + echo 'int the_libc; /* dummy */' >> conftest.c >> + ;; >> + esac >> + libgcc_cv_copysignl_lib="-lc" >> + if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD) >> + then >> + libgcc_cv_copysignl_lib="-lm" >> + fi > >AC_TRY_COMMAND is not part of the documented set of autoconf >commands. And this test seems reversed: shouldn't you add -lm if >AC_TRY_COMMAND fails? AC_TRY_COMMAND is used in the same file to check visibility support. An alternative would be to run nm(1), but for that i need to know the location of libc and libm so AC_TRY_COMMAND was easier. The test is supposed to - pass only on powerpc-*-*-uclibc* - fail otherwise so yes, that isn't quite right and should drop the case statement and check something like __UCLIBC__ + __powerpc__ instead (or use #if !defined\n#else\n#error glibm\n#endif but that would be more echo invocations). >I don't see any reason to write shell code that tests $target_alias true. >(and shouldn't it be $host_alias anyhow)? Just write C code that does >"#ifdef PPC"? It can't be the host_alias, we can as well build either a build=host=i386,target=ppc (cross-compiler) or a build=i386,host=target=ppc ("native" compiler, cross-compiled). > >The basic idea seems fine, though. Thanks. I'm attaching an updated patch, ChangeLog remains the same. Ok for trunk? --rwEMma7ioTxnRzrJ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="820-powerpc-softfloat-libm_for_copysignl.patch" diff -rdup gcc-4.4.0.old/gcc/config/t-slibgcc-elf-ver gcc-4.4.0/gcc/config/t-slibgcc-elf-ver --- gcc-4.4.0.old/gcc/config/t-slibgcc-elf-ver 2005-10-31 18:03:08.000000000 +0100 +++ gcc-4.4.0/gcc/config/t-slibgcc-elf-ver 2008-10-07 19:28:13.000000000 +0200 @@ -9,7 +9,7 @@ SHLIB_