summaryrefslogtreecommitdiff
path: root/patches/gcc/6.2.0/370-gcc-plugin-Win-Dont-need-undefined-extern-var-refs-nor-fpic.patch
blob: d8986d5f36d6e76d5bcbbcc46ef4f82696ff73dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
diff -urN gcc-5.3.0.orig/config/gcc-plugin.m4 gcc-5.3.0/config/gcc-plugin.m4
--- gcc-5.3.0.orig/config/gcc-plugin.m4	2015-12-19 14:39:04.120734900 +0000
+++ gcc-5.3.0/config/gcc-plugin.m4	2015-12-20 01:28:45.381965300 +0000
@@ -20,6 +20,9 @@
 
    pluginlibs=
 
+   PICFLAG="-fPIC"
+   UNDEFINEDPREAMBLE="extern int X;"
+   UNDEFINEDCODE="return X == 0;"
    case "${host}" in
      *-*-darwin*)
        if test x$build = x$host; then
@@ -30,6 +33,11 @@
 	 export_sym_check=
        fi
      ;;
+     *-*-mingw*|*-*-cygwin*|*-*-msys*)
+       PICFLAG=""
+       UNDEFINEDPREAMBLE=""
+       UNDEFINEDCODE=""
+     ;;
      *)
        if test x$build = x$host; then
 	 export_sym_check="objdump${exeext} -T"
@@ -81,17 +89,17 @@
      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
diff -urN gcc-5.3.0.orig/gcc/configure gcc-5.3.0/gcc/configure
--- gcc-5.3.0.orig/gcc/configure	2015-12-19 14:40:16.893975900 +0000
+++ gcc-5.3.0/gcc/configure	2015-12-20 01:28:45.472476700 +0000
@@ -28386,6 +28386,9 @@
 
    pluginlibs=
 
+   PICFLAG="-fPIC"
+   UNDEFINEDPREAMBLE="extern int X;"
+   UNDEFINEDCODE="return X == 0;"
    case "${host}" in
      *-*-darwin*)
        if test x$build = x$host; then
@@ -28396,6 +28399,11 @@
 	 export_sym_check=
        fi
      ;;
+     *-*-mingw*|*-*-cygwin*|*-*-msys*)
+       PICFLAG=""
+       UNDEFINEDPREAMBLE=""
+       UNDEFINEDCODE=""
+     ;;
      *)
        if test x$build = x$host; then
 	 export_sym_check="objdump${exeext} -T"
@@ -28508,23 +28516,23 @@
      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 -urN gcc-5.3.0.orig/libcc1/configure gcc-5.3.0/libcc1/configure
--- gcc-5.3.0.orig/libcc1/configure	2015-12-19 14:40:20.855979000 +0000
+++ gcc-5.3.0/libcc1/configure	2015-12-20 01:28:45.504980900 +0000
@@ -14500,6 +14500,9 @@
 
    pluginlibs=
 
+   PICFLAG="-fPIC"
+   UNDEFINEDPREAMBLE="extern int X;"
+   UNDEFINEDCODE="return X == 0;"
    case "${host}" in
      *-*-darwin*)
        if test x$build = x$host; then
@@ -14510,6 +14513,11 @@
 	 export_sym_check=
        fi
      ;;
+     *-*-mingw*|*-*-cygwin*|*-*-msys*)
+       PICFLAG=""
+       UNDEFINEDPREAMBLE=""
+       UNDEFINEDCODE=""
+     ;;
      *)
        if test x$build = x$host; then
 	 export_sym_check="objdump${exeext} -T"
@@ -14622,23 +14630,23 @@
      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;
 }