diff --git a/plugins/gcc8/gcc8.patch b/plugins/gcc8/gcc8.patch index 105d0f80..488f6b7f 100644 --- a/plugins/gcc8/gcc8.patch +++ b/plugins/gcc8/gcc8.patch @@ -5,7 +5,7 @@ Contains ad hoc patches for cross building. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Thu, 2 Feb 2017 02:05:50 +1100 -Subject: [PATCH 1/2] allow native cpu detection when building with clang +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 @@ -29,7 +29,7 @@ index 1111111..2222222 100644 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 6 Apr 2018 13:40:22 +1000 -Subject: [PATCH 2/2] remove hard-coded mingw from include path +Subject: [PATCH 2/3] remove hard-coded mingw from include path diff --git a/gcc/config.gcc b/gcc/config.gcc @@ -58,3 +58,51 @@ index 1111111..2222222 100644 /* 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 +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]; ++}