1 http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html
3 On glibc the libc.so carries a copy of the math function copysignl() but
4 on uClibc math functions like copysignl() live in libm. Since libgcc_s
5 contains unresolved symbols, any attempt to link against libgcc_s
6 without explicitely specifying -lm fails, resulting in a broken
7 bootstrap of the compiler.
9 Forward port to gcc 4.5.1 by Gustavo Zacarias <gustavo@zacarias.com.ar>
12 libgcc/Makefile.in | 4 +++-
13 libgcc/configure | 32 ++++++++++++++++++++++++++++++++
14 libgcc/configure.ac | 21 +++++++++++++++++++++
15 3 files changed, 56 insertions(+), 1 deletion(-)
17 Index: gcc-4.8.0/libgcc/Makefile.in
18 ===================================================================
19 --- gcc-4.8.0.orig/libgcc/Makefile.in 2013-02-04 20:06:20.000000000 +0100
20 +++ gcc-4.8.0/libgcc/Makefile.in 2013-03-24 09:12:43.000000000 +0100
22 decimal_float = @decimal_float@
23 enable_decimal_float = @enable_decimal_float@
24 fixed_point = @fixed_point@
25 +LIBGCC_LIBM = @LIBGCC_LIBM@
27 host_noncanonical = @host_noncanonical@
28 target_noncanonical = @target_noncanonical@
30 @multilib_dir@,$(MULTIDIR),$(subst \
31 @shlib_objs@,$(objects) libgcc.a,$(subst \
32 @shlib_base_name@,libgcc_s,$(subst \
33 + @libgcc_libm@,$(LIBGCC_LIBM),$(subst \
34 @shlib_map_file@,$(mapfile),$(subst \
35 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
36 - @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
37 + @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))))
39 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
40 # @multilib_flags@ is still needed because this may use
41 Index: gcc-4.8.0/libgcc/configure
42 ===================================================================
43 --- gcc-4.8.0.orig/libgcc/configure 2012-11-05 00:08:42.000000000 +0100
44 +++ gcc-4.8.0/libgcc/configure 2013-03-24 09:12:43.000000000 +0100
53 @@ -4481,6 +4482,37 @@
57 +# On powerpc libgcc_s references copysignl which is a libm function but
58 +# glibc apparently also provides it via libc as opposed to uClibc where
60 +echo "$as_me:$LINENO: checking for library containing copysignl" >&5
61 +echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6
62 +if test "${libgcc_cv_copysignl_lib+set}" = set; then
63 + echo $ECHO_N "(cached) $ECHO_C" >&6
66 + echo '#include <features.h>' > conftest.c
67 + echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
68 + libgcc_cv_copysignl_lib="-lc"
69 + if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5'
70 + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
73 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
74 + (exit $ac_status); }; }
76 + libgcc_cv_copysignl_lib="-lm"
81 +echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
82 +echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
84 +case /${libgcc_cv_copysignl_lib}/ in
85 + /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
89 # Conditionalize the makefile for this target machine.
91 Index: gcc-4.8.0/libgcc/configure.ac
92 ===================================================================
93 --- gcc-4.8.0.orig/libgcc/configure.ac 2012-10-15 15:10:30.000000000 +0200
94 +++ gcc-4.8.0/libgcc/configure.ac 2013-03-24 09:12:43.000000000 +0100
97 AC_SUBST(set_have_cc_tls)
99 +# On powerpc libgcc_s references copysignl which is a libm function but
100 +# glibc apparently also provides it via libc as opposed to uClibc where
103 + libgcc_cv_copysignl_lib,
104 + echo '#include <features.h>' > conftest.c
105 + echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
106 + libgcc_cv_copysignl_lib="-lc"
107 + if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
109 + libgcc_cv_copysignl_lib="-lm"
114 +case /${libgcc_cv_copysignl_lib}/ in
115 + /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
118 +AC_SUBST(LIBGCC_LIBM)
120 # See if we have emulated thread-local storage.