aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-01-31 11:25:55 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-01-31 11:25:55 -0500
commit99a82a1e1698a3bf85e5bcf32843c8070c508119 (patch)
treef47ec6fb32e6cbaac73ce29db694761dd4d6fd28
parentf1f82a37ae52962a086ab9ae516a1360d03a9b56 (diff)
downloadgcc-99a82a1e1698a3bf85e5bcf32843c8070c508119.zip
gcc-99a82a1e1698a3bf85e5bcf32843c8070c508119.tar.gz
gcc-99a82a1e1698a3bf85e5bcf32843c8070c508119.tar.bz2
re PR c++/55800 (Link failure with thread_local in unnamed namespace)
PR c++/55800 * decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable. From-SVN: r207360
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/testsuite/g++.dg/tls/thread_local8.C11
3 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0909bf1..4f38a6d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/55800
+ * decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.
+
2014-01-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/59082
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b2103c8..2216591 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2949,7 +2949,7 @@ get_tls_init_fn (tree var)
TREE_PUBLIC (fn) = TREE_PUBLIC (var);
DECL_ARTIFICIAL (fn) = true;
DECL_COMDAT (fn) = DECL_COMDAT (var);
- DECL_EXTERNAL (fn) = true;
+ DECL_EXTERNAL (fn) = DECL_EXTERNAL (var);
if (DECL_ONE_ONLY (var))
make_decl_one_only (fn, cxx_comdat_group (fn));
if (TREE_PUBLIC (var))
diff --git a/gcc/testsuite/g++.dg/tls/thread_local8.C b/gcc/testsuite/g++.dg/tls/thread_local8.C
new file mode 100644
index 0000000..206e7b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tls/thread_local8.C
@@ -0,0 +1,11 @@
+// PR c++/55800
+// { dg-options "-std=c++11" }
+// { dg-require-alias "" }
+// { dg-final { scan-assembler "_ZTH12foo_instance" { target tls_native } } }
+
+struct foo
+{
+ foo();
+};
+
+thread_local foo foo_instance;