1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/gcc/4.4.3/380-powerpc-libgcc_s-link-libm.patch Sat Mar 03 23:38:33 2012 +0100
1.3 @@ -0,0 +1,135 @@
1.4 +http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html
1.5 +
1.6 +On glibc the libc.so carries a copy of the math function copysignl() but
1.7 +on uClibc math functions like copysignl() live in libm. Since libgcc_s
1.8 +contains unresolved symbols, any attempt to link against libgcc_s
1.9 +without explicitely specifying -lm fails, resulting in a broken
1.10 +bootstrap of the compiler.
1.11 +
1.12 +
1.13 +diff -rdup gcc-4.4.0.old/gcc/config/t-slibgcc-elf-ver gcc-4.4.0/gcc/config/t-slibgcc-elf-ver
1.14 +--- gcc-4.4.0.old/gcc/config/t-slibgcc-elf-ver 2005-10-31 18:03:08.000000000 +0100
1.15 ++++ gcc-4.4.0/gcc/config/t-slibgcc-elf-ver 2008-10-07 19:28:13.000000000 +0200
1.16 +@@ -9,7 +9,7 @@ SHLIB_MAP = @shlib_map_file@
1.17 + SHLIB_OBJS = @shlib_objs@
1.18 + SHLIB_DIR = @multilib_dir@
1.19 + SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
1.20 +-SHLIB_LC = -lc
1.21 ++SHLIB_LC = @libgcc_libm@ -lc
1.22 + SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
1.23 + SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
1.24 + $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
1.25 +diff -rdup gcc-4.4.0.old/libgcc/configure gcc-4.4.0/libgcc/configure
1.26 +--- gcc-4.4.0.old/libgcc/configure 2008-07-17 10:40:53.000000000 +0200
1.27 ++++ gcc-4.4.0/libgcc/configure 2008-10-07 19:40:48.000000000 +0200
1.28 +@@ -272,7 +272,7 @@ PACKAGE_STRING='GNU C Runtime Library 1.
1.29 + PACKAGE_BUGREPORT=''
1.30 +
1.31 + ac_unique_file="static-object.mk"
1.32 +-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'
1.33 ++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'
1.34 + ac_subst_files=''
1.35 + ac_pwd=`pwd`
1.36 +
1.37 +@@ -3522,6 +3522,39 @@ if test "$enable_tls $gcc_cv_have_cc_tls
1.38 + fi
1.39 +
1.40 +
1.41 ++# On powerpc libgcc_s references copysignl which is a libm function but
1.42 ++# glibc apparently also provides it via libc as opposed to uClibc where
1.43 ++# it lives in libm.
1.44 ++echo "$as_me:$LINENO: checking for library containing copysignl" >&5
1.45 ++echo $ECHO_N "checking for library containing copysignl... $ECHO_C" >&6
1.46 ++if test "${libgcc_cv_copysignl_lib+set}" = set; then
1.47 ++ echo $ECHO_N "(cached) $ECHO_C" >&6
1.48 ++else
1.49 ++
1.50 ++ echo '#include <features.h>' > conftest.c
1.51 ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
1.52 ++ libgcc_cv_copysignl_lib="-lc"
1.53 ++ if { ac_try='${CC-cc} -S conftest.c -o conftest.s 1>&5'
1.54 ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1.55 ++ (eval $ac_try) 2>&5
1.56 ++ ac_status=$?
1.57 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
1.58 ++ (exit $ac_status); }; }
1.59 ++ then
1.60 ++ libgcc_cv_copysignl_lib="-lm"
1.61 ++ fi
1.62 ++ rm -f conftest.*
1.63 ++
1.64 ++fi
1.65 ++echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
1.66 ++echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
1.67 ++
1.68 ++case /${libgcc_cv_copysignl_lib}/ in
1.69 ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
1.70 ++ *) LIBGCC_LIBM= ;;
1.71 ++esac
1.72 ++
1.73 ++
1.74 + # Conditionalize the makefile for this target machine.
1.75 + tmake_file_=
1.76 + for f in ${tmake_file}
1.77 +@@ -4242,6 +4275,7 @@ s,@enable_decimal_float@,$enable_decimal
1.78 + s,@fixed_point@,$fixed_point,;t t
1.79 + s,@vis_hide@,$vis_hide,;t t
1.80 + s,@set_have_cc_tls@,$set_have_cc_tls,;t t
1.81 ++s,@LIBGCC_LIBM@,$LIBGCC_LIBM,;t t
1.82 + s,@tmake_file@,$tmake_file,;t t
1.83 + s,@extra_parts@,$extra_parts,;t t
1.84 + s,@asm_hidden_op@,$asm_hidden_op,;t t
1.85 +diff -rdup gcc-4.4.0.old/libgcc/configure.ac gcc-4.4.0/libgcc/configure.ac
1.86 +--- gcc-4.4.0.old/libgcc/configure.ac 2008-07-17 10:40:53.000000000 +0200
1.87 ++++ gcc-4.4.0/libgcc/configure.ac 2008-10-07 19:34:48.000000000 +0200
1.88 +@@ -203,6 +203,27 @@ if test "$enable_tls $gcc_cv_have_cc_tls
1.89 + fi
1.90 + AC_SUBST(set_have_cc_tls)
1.91 +
1.92 ++# On powerpc libgcc_s references copysignl which is a libm function but
1.93 ++# glibc apparently also provides it via libc as opposed to uClibc where
1.94 ++# it lives in libm.
1.95 ++AC_CACHE_CHECK
1.96 ++ libgcc_cv_copysignl_lib,
1.97 ++ echo '#include <features.h>' > conftest.c
1.98 ++ echo 'int the_libc = __UCLIBC__ + __powerpc__;' >> conftest.c
1.99 ++ libgcc_cv_copysignl_lib="-lc"
1.100 ++ if AC_TRY_COMMAND(${CC-cc} -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD)
1.101 ++ then
1.102 ++ libgcc_cv_copysignl_lib="-lm"
1.103 ++ fi
1.104 ++ rm -f conftest.*
1.105 ++ ])
1.106 ++
1.107 ++case /${libgcc_cv_copysignl_lib}/ in
1.108 ++ /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
1.109 ++ *) LIBGCC_LIBM= ;;
1.110 ++esac
1.111 ++AC_SUBST(LIBGCC_LIBM)
1.112 ++
1.113 + # Conditionalize the makefile for this target machine.
1.114 + tmake_file_=
1.115 + for f in ${tmake_file}
1.116 +diff -rdup gcc-4.4.0.old/libgcc/Makefile.in gcc-4.4.0/libgcc/Makefile.in
1.117 +--- gcc-4.4.0.old/libgcc/Makefile.in 2008-07-17 10:40:53.000000000 +0200
1.118 ++++ gcc-4.4.0/libgcc/Makefile.in 2008-10-07 19:28:13.000000000 +0200
1.119 +@@ -40,6 +40,7 @@ enable_shared = @enable_shared@
1.120 + decimal_float = @decimal_float@
1.121 + enable_decimal_float = @enable_decimal_float@
1.122 + fixed_point = @fixed_point@
1.123 ++LIBGCC_LIBM = @LIBGCC_LIBM@
1.124 +
1.125 + host_noncanonical = @host_noncanonical@
1.126 +
1.127 +@@ -786,9 +787,10 @@ libgcc_s$(SHLIB_EXT): $(libgcc-s-objects
1.128 + @multilib_dir@,$(MULTIDIR),$(subst \
1.129 + @shlib_objs@,$(objects),$(subst \
1.130 + @shlib_base_name@,libgcc_s,$(subst \
1.131 ++ @libgcc_libm@,$(LIBGCC_LIBM),$(subst \
1.132 + @shlib_map_file@,$(mapfile),$(subst \
1.133 + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
1.134 +- @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
1.135 ++ @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))))
1.136 +
1.137 + libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
1.138 + # @multilib_flags@ is still needed because this may use