summaryrefslogtreecommitdiffstats
path: root/plugins/gcc8/gcc8.patch
blob: 488f6b7f297d41f5fb37e96357a0d060d271d6ea (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
This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 2 Feb 2017 02:05:50 +1100
Subject: [PATCH 1/3] allow native cpu detection when building with clang

function was disabled for non-gcc5 in:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b587c12551143c14f023860a1dbdf7316ae71f27;hp=43096b526a9f23008b9769372f11475ae63487bc

clang can build it correctly and this should probably be a feature test

diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 1111111..2222222 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3.  If not see
 
 const char *host_detect_local_cpu (int argc, const char **argv);
 
-#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__))
+#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__)) || defined(__clang__)
 #include "cpuid.h"
 
 struct cache_desc

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Fri, 6 Apr 2018 13:40:22 +1000
Subject: [PATCH 2/3] remove hard-coded mingw from include path


diff --git a/gcc/config.gcc b/gcc/config.gcc
index 1111111..2222222 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1801,7 +1801,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 			tmake_file="${tmake_file} i386/t-mingw-w32"
 			;;
 	esac
-        native_system_header_dir=/mingw/include
+        native_system_header_dir=/include
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
 	extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
 	case ${target} in
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 1111111..2222222 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -172,7 +172,7 @@ along with GCC; see the file COPYING3.  If not see
 /* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
    macro contains POSIX-style path.  See bug 52947.  */
 #undef NATIVE_SYSTEM_HEADER_DIR
-#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
+#define NATIVE_SYSTEM_HEADER_DIR "/include"
 
 /* Output STRING, a string representing a filename, to FILE.
    We canonicalize it to be in Unix format (backslashes are replaced

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sat, 9 Mar 2019 12:08:23 +0000
Subject: [PATCH 3/3] PR c/88568 * attribs.c (handle_dll_attribute): Don't
 clear TREE_STATIC for dllimport on VAR_DECLs with RECORD_TYPE or UNION_TYPE
 DECL_CONTEXT.

taken from:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923214

diff --git a/gcc/attribs.c b/gcc/attribs.c
index 1111111..2222222 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -1685,8 +1685,11 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
 	     a function global scope, unless declared static.  */
 	  if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
 	    TREE_PUBLIC (node) = 1;
-	  /* Clear TREE_STATIC because DECL_EXTERNAL is set.  */
-	  TREE_STATIC (node) = 0;
+	  /* Clear TREE_STATIC because DECL_EXTERNAL is set, unless
+	     it is a C++ static data member.  */
+	  if (DECL_CONTEXT (node) == NULL_TREE
+	      || !RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (node)))
+	    TREE_STATIC (node) = 0;
 	}
 
       if (*no_add_attrs == false)
diff --git a/gcc/testsuite/g++.dg/other/pr88568.C b/gcc/testsuite/g++.dg/other/pr88568.C
new file mode 100644
index 000000000..9d344fd91
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr88568.C
@@ -0,0 +1,13 @@
+// PR c/88568
+// { dg-do compile }
+// { dg-require-dll "" }
+
+struct S {
+  __attribute__((dllimport)) static const char foo[];
+};
+
+int
+foo (int x)
+{
+  return S::foo[x];
+}