crosstool-ng/patches/gcc/linaro-4.8-2015.06/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
Alexey Neyman 99283866cc Add patches to Linaro GCC
Same as the base release as long as they applied.
MUSL patches didn't, removed.

Also, unobsolete Linaro GCC5 now that they rolled out a new release.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-02-28 00:57:53 -08:00

105 lines
3.0 KiB
Diff

diff -urpN '--exclude=autom4te.cache' gcc-4.8.5.orig/gcc/configure gcc-4.8.5/gcc/configure
--- gcc-4.8.5.orig/gcc/configure 2014-12-08 03:29:43.000000000 -0800
+++ gcc-4.8.5/gcc/configure 2017-02-11 16:57:27.424807994 -0800
@@ -27364,6 +27364,9 @@ fi
pluginlibs=
+PICFLAG="-fPIC"
+UNDEFINEDPREAMBLE="extern int X;"
+UNDEFINEDCODE="return X == 0;"
case "${host}" in
*-*-darwin*)
@@ -27375,6 +27378,11 @@ case "${host}" in
export_sym_check=
fi
;;
+ *-*-mingw*|*-*-cygwin*|*-*-msys*)
+ PICFLAG=""
+ UNDEFINEDPREAMBLE=""
+ UNDEFINEDCODE=""
+ ;;
*)
if test x$build = x$host; then
export_sym_check="objdump${exeext} -T"
@@ -27487,23 +27495,23 @@ fi
case "${host}" in
*-*-darwin*)
CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
- CFLAGS="$CFLAGS -fPIC"
+ CFLAGS="$CFLAGS ${PICFLAG}"
LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
;;
*)
- CFLAGS="$CFLAGS -fPIC"
- LDFLAGS="$LDFLAGS -fPIC -shared"
+ CFLAGS="$CFLAGS ${PICFLAG}"
+ LDFLAGS="$LDFLAGS ${PICFLAG} -shared"
;;
esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fPIC -shared" >&5
-$as_echo_n "checking for -fPIC -shared... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${PICFLAG} -shared" >&5
+$as_echo_n "checking for ${PICFLAG} -shared... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-extern int X;
+${UNDEFINEDPREAMBLE}
int
main ()
{
-return X == 0;
+${UNDEFINEDCODE}
;
return 0;
}
diff -urpN '--exclude=autom4te.cache' gcc-4.8.5.orig/gcc/configure.ac gcc-4.8.5/gcc/configure.ac
--- gcc-4.8.5.orig/gcc/configure.ac 2014-12-08 03:29:43.000000000 -0800
+++ gcc-4.8.5/gcc/configure.ac 2017-02-11 16:57:27.424807994 -0800
@@ -5243,6 +5243,9 @@ enable_plugin=$enableval,
enable_plugin=yes; default_plugin=yes)
pluginlibs=
+PICFLAG="-fPIC"
+UNDEFINEDPREAMBLE="extern int X;"
+UNDEFINEDCODE="return X == 0;"
case "${host}" in
*-*-darwin*)
@@ -5254,6 +5257,11 @@ case "${host}" in
export_sym_check=
fi
;;
+ *-*-mingw*|*-*-cygwin*|*-*-msys*)
+ PICFLAG=""
+ UNDEFINEDPREAMBLE=""
+ UNDEFINEDCODE=""
+ ;;
*)
if test x$build = x$host; then
export_sym_check="objdump${exeext} -T"
@@ -5305,17 +5313,17 @@ if test x"$enable_plugin" = x"yes"; then
case "${host}" in
*-*-darwin*)
CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
- CFLAGS="$CFLAGS -fPIC"
+ CFLAGS="$CFLAGS ${PICFLAG}"
LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
;;
*)
- CFLAGS="$CFLAGS -fPIC"
- LDFLAGS="$LDFLAGS -fPIC -shared"
+ CFLAGS="$CFLAGS ${PICFLAG}"
+ LDFLAGS="$LDFLAGS ${PICFLAG} -shared"
;;
esac
- AC_MSG_CHECKING([for -fPIC -shared])
+ AC_MSG_CHECKING([for ${PICFLAG} -shared])
AC_TRY_LINK(
- [extern int X;],[return X == 0;],
+ [${UNDEFINEDPREAMBLE}],[${UNDEFINEDCODE}],
[AC_MSG_RESULT([yes]); have_pic_shared=yes],
[AC_MSG_RESULT([no]); have_pic_shared=no])
if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then