sg3-utils: add newer buildable version
[openembedded.git] / recipes / gcc / gcc-4.4.1 / gcc-link-libgcc-with-libm.patch
1
2 <tches-return-228648-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org Tue Oct 07 18:11:15 2008
3 Return-Path: <gcc-patches-return-228648-listarch-gcc-patches=gcc dot gnu dot org at gcc dot gnu dot org>
4 Delivered-To: listarch-gcc-patches at gcc dot gnu dot org
5 Received: (qmail 27356 invoked by alias); 7 Oct 2008 18:11:15 -0000
6 Received: (qmail 27347 invoked by uid 22791); 7 Oct 2008 18:11:13 -0000
7 X-Spam-Check-By: sourceware.org
8 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
9 Received: by fg-out-1718.google.com with SMTP id e21so2412591fga.28         for <gcc-patches@gcc.gnu.org>; Tue, 07 Oct 2008 11:10:15 -0700 (PDT)
10 Received: by 10.181.25.18 with SMTP id c18mr5278303bkj.61.1223403015435;         Tue, 07 Oct 2008 11:10:15 -0700 (PDT)
11 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)
12 Received: from cow by s42.loc with local (Exim 4.69)    (envelope-from <rep.dot.nop@gmail.com>)         id 1KnH0l-00050F-7O; Tue, 07 Oct 2008 20:10:19 +0200
13 Date: Tue, 7 Oct 2008 20:10:19 +0200
14 From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
15 To: Ian Lance Taylor <iant at google dot com>
16 Cc: gcc-patches at gcc dot gnu dot org
17 Subject: Re: [PATCH] link libgcc_s.so against a lib containing copysignl on     powerpc-*-linux-uclibc
18 Message-ID: <20081007181019.GB5178@mx.loc>
19 References: <20081007141721.GG9250@mx.loc> <m33aj82wcc.fsf@google.com>
20 MIME-Version: 1.0
21 Content-Type: multipart/mixed; boundary="rwEMma7ioTxnRzrJ"
22 Content-Disposition: inline
23 In-Reply-To: <m33aj82wcc dot fsf at google dot com>
24 User-Agent: Mutt/1.5.18 (2008-05-17)
25 Mailing-List: contact gcc-patches-help at gcc dot gnu dot org; run by ezmlm
26 Precedence: bulk
27 List-Id: <gcc-patches.gcc.gnu.org>
28 List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>
29 List-Post: <mailto:gcc-patches at gcc dot gnu dot org>
30 List-Help: <mailto:gcc-patches-help at gcc dot gnu dot org>
31 Sender: gcc-patches-owner at gcc dot gnu dot org
32 Delivered-To: mailing list gcc-patches at gcc dot gnu dot org
33
34
35 --rwEMma7ioTxnRzrJ
36 Content-Type: text/plain; charset=us-ascii
37 Content-Disposition: inline
38
39 On Tue, Oct 07, 2008 at 09:39:31AM -0700, Ian Lance Taylor wrote:
40 >Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> writes:
41 >
42 >> gcc/ChangeLog:
43 >>
44 >> 2008-10-07  Bernhard Reutner-Fischer  <>
45 >>
46 >>      * config/t-slibgcc-elf-ver (SHLIB_LC): Also link against
47 >>      @libgcc_libm@.
48 >>
49 >> libgcc/ChangeLog:
50 >>
51 >> 2008-10-07  Bernhard Reutner-Fischer  <>
52 >>
53 >>      * configure.ac (libgcc_cv_copysignl_lib, LIBGCC_LIBM): New
54 >>      variables to denote if we are on powerpc-uclibc where libm
55 >>      functions live in libm.
56 >>      * Makefile.in (LIBGCC_LIBM): Set.
57 >>      (libgcc_s$(SHLIB_EXT)): Substitute @libgcc_libm@ with
58 >>      $(LIBGCC_LIBM).
59 >>      * (configure): Regenerate.
60 >
61 >
62 >> +# On powerpc libgcc_s references copysignl which is a libm function but
63 >> +# glibc apparently also provides it via libc as opposed to uClibc where
64 >> +# it lives in libm.
65 >> +dnl save_LIBS="$LIBS"
66 >> +dnl LIBS=
67 >> +dnl AC_SEARCH_LIBS(copysignl, m)
68 >> +dnl LIBGCC_LIBS="$LIBS"
69 >> +dnl LIBS="$save_LIBS"
70 >> +dnl AC_SUBST(LIBGCC_LIBS)
71 >
72 >Why don't you run these commands listed as dnl?
73
74 I don't have a working compiler here yet and GCC_NO_EXECUTABLES. I can
75 only assemble, not link (we're about to build the libgcc for the
76 compiler here).
77 >
78 >> +AC_CACHE_CHECK([for library containing copysignl],
79 >> +  libgcc_cv_copysignl_lib, [
80 >> +    echo '#include <features.h>' > conftest.c
81 >> +    case $target_alias in
82 >> +    *powerpc*)
83 >> +    echo 'int the_libc = __UCLIBC__;' >> conftest.c
84 >> +    ;;
85 >> +    *)
86 >> +    echo 'int the_libc; /* dummy */' >> conftest.c
87 >> +    ;;
88 >> +    esac
89 >> +    libgcc_cv_copysignl_lib="-lc"
90 >> +    if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
91 >> +    then
92 >> +    libgcc_cv_copysignl_lib="-lm"
93 >> +    fi
94 >
95 >AC_TRY_COMMAND is not part of the documented set of autoconf
96 >commands.  And this test seems reversed: shouldn't you add -lm if
97 >AC_TRY_COMMAND fails?
98
99 AC_TRY_COMMAND is used in the same file to check visibility support.
100 An alternative would be to run nm(1), but for that i need to know the
101 location of libc and libm so AC_TRY_COMMAND was easier.
102
103 The test is supposed to
104 - pass only on powerpc-*-*-uclibc*
105 - fail otherwise
106 so yes, that isn't quite right and should drop the case statement and
107 check something like __UCLIBC__ + __powerpc__ instead (or use #if
108 !defined\n#else\n#error glibm\n#endif but that would be more echo
109 invocations).
110
111
112 >I don't see any reason to write shell code that tests $target_alias
113
114 true.
115
116 >(and shouldn't it be $host_alias anyhow)?  Just write C code that does
117 >"#ifdef PPC"?
118
119 It can't be the host_alias, we can as well build either a
120 build=host=i386,target=ppc (cross-compiler) or a
121 build=i386,host=target=ppc ("native" compiler, cross-compiled).
122 >
123 >The basic idea seems fine, though.
124
125 Thanks. I'm attaching an updated patch, ChangeLog remains the same.
126 Ok for trunk?
127
128 --rwEMma7ioTxnRzrJ
129 Content-Type: text/x-diff; charset=us-ascii
130 Content-Disposition: attachment; filename="820-powerpc-softfloat-libm_for_copysignl.patch"
131
132 diff -rdup gcc-4.4.0.old/gcc/config/t-slibgcc-elf-ver gcc-4.4.0/gcc/config/t-slibgcc-elf-ver
133 --- gcc-4.4.0.old/gcc/config/t-slibgcc-elf-ver  2005-10-31 18:03:08.000000000 +0100
134 +++ gcc-4.4.0/gcc/config/t-slibgcc-elf-ver      2008-10-07 19:28:13.000000000 +0200
135 @@ -9,7 +9,7 @@ SHLIB_MAP = @shlib_map_file@
136  SHLIB_OBJS = @shlib_objs@
137  SHLIB_DIR = @multilib_dir@
138  SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
139 -SHLIB_LC = -lc
140 +SHLIB_LC = @libgcc_libm@ -lc
141  
142  SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
143         -Wl,--soname=$(SHLIB_SONAME) \
144 diff -rdup gcc-4.4.0.old/libgcc/configure gcc-4.4.0/libgcc/configure
145 --- gcc-4.4.0.old/libgcc/configure      2008-07-17 10:40:53.000000000 +0200
146 +++ gcc-4.4.0/libgcc/configure  2008-10-07 19:40:48.000000000 +0200
147 @@ -272,7 +272,7 @@ PACKAGE_STRING='GNU C Runtime Library 1.
148  PACKAGE_BUGREPORT=''
149  
150  ac_unique_file="static-object.mk"
151 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcc_topdir enable_shared slibdir INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK build build_cpu build_vendor build_os host host_cpu host_vendor host_os host_noncanonical build_libsubdir build_subdir host_subdir target_subdir AR ac_ct_AR LIPO ac_ct_LIPO NM ac_ct_NM RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP decimal_float enable_decimal_float fixed_point vis_hide set_have_cc_tls tmake_file extra_parts asm_hidden_op LIBOBJS LTLIBOBJS'
152 +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcc_topdir enable_shared slibdir INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK build build_cpu build_vendor build_os host host_cpu host_vendor host_os host_noncanonical build_libsubdir build_subdir host_subdir target_subdir AR ac_ct_AR LIPO ac_ct_LIPO NM ac_ct_NM RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP decimal_float enable_decimal_float fixed_point vis_hide set_have_cc_tls LIBGCC_LIBM tmake_file extra_parts asm_hidden_op LIBOBJS LTLIBOBJS'
153  ac_subst_files=''
154  ac_pwd=`pwd`
155  
156 @@ -3522,6 +3522,39 @@ if test "$enable_tls $gcc_cv_have_cc_tls
157  fi
158  
159  
160 +# On powerpc libgcc_s references copysignl which is a libm function but
161 +# glibc apparently also provides it via libc as opposed to uClibc where
162 +# it lives in libm.
163 +echo "$as_me:$LINENO: checking for library containing copysignl" >&5
164 +echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6
165 +if test "${libgcc_cv_copysignl_lib+set}" = set; then
166 +  echo $ECHO_N "(cached) $ECHO_C" >&6
167 +else
168 +
169 +    echo '#include <features.h>' > conftest.c
170 +    echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
171 +    libgcc_cv_copysignl_lib="-lc"
172 +    if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5'
173 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
174 +  (eval $ac_try) 2>&5
175 +  ac_status=$?
176 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
177 +  (exit $ac_status); }; }
178 +    then
179 +       libgcc_cv_copysignl_lib="-lm"
180 +    fi
181 +    rm -f conftest.*
182 +
183 +fi
184 +echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
185 +echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
186 +
187 +case /${libgcc_cv_copysignl_lib}/ in
188 +  /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
189 +  *) LIBGCC_LIBM= ;;
190 +esac
191 +
192 +
193  # Conditionalize the makefile for this target machine.
194  tmake_file_=
195  for f in ${tmake_file}
196 @@ -4242,6 +4275,7 @@ s,@enable_decimal_float@,$enable_decimal
197  s,@fixed_point@,$fixed_point,;t t
198  s,@vis_hide@,$vis_hide,;t t
199  s,@set_have_cc_tls@,$set_have_cc_tls,;t t
200 +s,@LIBGCC_LIBM@,$LIBGCC_LIBM,;t t
201  s,@tmake_file@,$tmake_file,;t t
202  s,@extra_parts@,$extra_parts,;t t
203  s,@asm_hidden_op@,$asm_hidden_op,;t t
204 diff -rdup gcc-4.4.0.old/libgcc/configure.ac gcc-4.4.0/libgcc/configure.ac
205 --- gcc-4.4.0.old/libgcc/configure.ac   2008-07-17 10:40:53.000000000 +0200
206 +++ gcc-4.4.0/libgcc/configure.ac       2008-10-07 19:34:48.000000000 +0200
207 @@ -203,6 +203,27 @@ if test "$enable_tls $gcc_cv_have_cc_tls
208  fi
209  AC_SUBST(set_have_cc_tls)
210  
211 +# On powerpc libgcc_s references copysignl which is a libm function but
212 +# glibc apparently also provides it via libc as opposed to uClibc where
213 +# it lives in libm.
214 +AC_CACHE_CHECK([for library containing copysignl],
215 +  libgcc_cv_copysignl_lib, [
216 +    echo '#include <features.h>' > conftest.c
217 +    echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
218 +    libgcc_cv_copysignl_lib="-lc"
219 +    if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
220 +    then
221 +       libgcc_cv_copysignl_lib="-lm"
222 +    fi
223 +    rm -f conftest.*
224 +  ])
225 +
226 +case /${libgcc_cv_copysignl_lib}/ in
227 +  /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
228 +  *) LIBGCC_LIBM= ;;
229 +esac
230 +AC_SUBST(LIBGCC_LIBM)
231 +
232  # Conditionalize the makefile for this target machine.
233  tmake_file_=
234  for f in ${tmake_file}
235 diff -rdup gcc-4.4.0.old/libgcc/Makefile.in gcc-4.4.0/libgcc/Makefile.in
236 --- gcc-4.4.0.old/libgcc/Makefile.in    2008-07-17 10:40:53.000000000 +0200
237 +++ gcc-4.4.0/libgcc/Makefile.in        2008-10-07 19:28:13.000000000 +0200
238 @@ -40,6 +40,7 @@ enable_shared = @enable_shared@
239  decimal_float = @decimal_float@
240  enable_decimal_float = @enable_decimal_float@
241  fixed_point = @fixed_point@
242 +LIBGCC_LIBM = @LIBGCC_LIBM@
243  
244  host_noncanonical = @host_noncanonical@
245  
246 @@ -786,9 +787,10 @@ libgcc_s$(SHLIB_EXT): $(libgcc-s-objects
247                 @multilib_dir@,$(MULTIDIR),$(subst \
248                 @shlib_objs@,$(objects),$(subst \
249                 @shlib_base_name@,libgcc_s,$(subst \
250 +               @libgcc_libm@,$(LIBGCC_LIBM),$(subst \
251                 @shlib_map_file@,$(mapfile),$(subst \
252                 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
253 -               @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
254 +               @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))))
255  
256  libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
257         # @multilib_flags@ is still needed because this may use
258
259 --rwEMma7ioTxnRzrJ--