The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / gcc / 4.8.4 / 1000-powerpc-link-with-math-lib.patch.conditional
1 http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00269.html
2
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.
8
9 Forward port to gcc 4.5.1 by Gustavo Zacarias <gustavo@zacarias.com.ar>
10
11 ---
12  libgcc/Makefile.in  |    4 +++-
13  libgcc/configure    |   32 ++++++++++++++++++++++++++++++++
14  libgcc/configure.ac |   21 +++++++++++++++++++++
15  3 files changed, 56 insertions(+), 1 deletion(-)
16
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
21 @@ -41,6 +41,7 @@
22  decimal_float = @decimal_float@
23  enable_decimal_float = @enable_decimal_float@
24  fixed_point = @fixed_point@
25 +LIBGCC_LIBM = @LIBGCC_LIBM@
26  
27  host_noncanonical = @host_noncanonical@
28  target_noncanonical = @target_noncanonical@
29 @@ -927,9 +928,10 @@
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)))))))))
38  
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
45 @@ -564,6 +564,7 @@
46  tmake_file
47  sfp_machine_header
48  set_use_emutls
49 +LIBGCC_LIBM
50  set_have_cc_tls
51  vis_hide
52  fixed_point
53 @@ -4481,6 +4482,37 @@
54         fi
55  fi
56  
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
59 +# it lives in libm.
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
64 +else
65 +
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
71 +  (eval $ac_try) 2>&5
72 +  ac_status=$?
73 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
74 +  (exit $ac_status); }; }
75 +    then
76 +       libgcc_cv_copysignl_lib="-lm"
77 +    fi
78 +    rm -f conftest.*
79 +
80 +fi
81 +echo "$as_me:$LINENO: result: $libgcc_cv_copysignl_lib" >&5
82 +echo "${ECHO_T}$libgcc_cv_copysignl_lib" >&6
83 +
84 +case /${libgcc_cv_copysignl_lib}/ in
85 +  /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
86 +  *) LIBGCC_LIBM= ;;
87 +esac
88  
89  # Conditionalize the makefile for this target machine.
90  tmake_file_=
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
95 @@ -326,6 +326,27 @@
96  fi
97  AC_SUBST(set_have_cc_tls)
98  
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
101 +# it lives in libm.
102 +AC_CACHE_CHECK
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)
108 +    then
109 +       libgcc_cv_copysignl_lib="-lm"
110 +    fi
111 +    rm -f conftest.*
112 +  ])
113 +
114 +case /${libgcc_cv_copysignl_lib}/ in
115 +  /-lm/) LIBGCC_LIBM="$LIBGCC_LIBM -lm" ;;
116 +  *) LIBGCC_LIBM= ;;
117 +esac
118 +AC_SUBST(LIBGCC_LIBM)
119 +
120  # See if we have emulated thread-local storage.
121  GCC_CHECK_EMUTLS
122  set_use_emutls=