diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-05-10 07:36:38 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2018-05-10 07:36:38 +0000 |
commit | 86c12f7629b43cbc259d8bbcb1875fff1f8e6a4f (patch) | |
tree | 5072c928276d92ea5db82bc91219a9b1b942ed7d /gcc/cp | |
parent | 09dd57a3a4c2e71a972257587f1c3944a51d4846 (diff) | |
download | gcc-86c12f7629b43cbc259d8bbcb1875fff1f8e6a4f.zip gcc-86c12f7629b43cbc259d8bbcb1875fff1f8e6a4f.tar.gz gcc-86c12f7629b43cbc259d8bbcb1875fff1f8e6a4f.tar.bz2 |
re PR c++/85400 (invalid Local Dynamic TLS relaxation for symbol defined in method)
PR c++/85400
cp/
* decl2.c (adjust_var_decl_tls_model): New static function.
(comdat_linkage): Call it on a variable.
(maybe_make_one_only): Likewise.
c-family/
* c-attribs.c (handle_visibility_attribute): Do not set no_add_attrs.
From-SVN: r260106
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98249e9..a2de8f6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2018-05-10 Eric Botcazou <ebotcazou@adacore.com> + + PR c++/85400 + * decl2.c (adjust_var_decl_tls_model): New static function. + (comdat_linkage): Call it on a variable. + (maybe_make_one_only): Likewise. + 2018-05-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/85713 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9aae34a..6f3ad4c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1838,6 +1838,17 @@ mark_vtable_entries (tree decl) } } +/* Adjust the TLS model on variable DECL if need be, typically after + the linkage of DECL has been modified. */ + +static void +adjust_var_decl_tls_model (tree decl) +{ + if (CP_DECL_THREAD_LOCAL_P (decl) + && !lookup_attribute ("tls_model", DECL_ATTRIBUTES (decl))) + set_decl_tls_model (decl, decl_default_tls_model (decl)); +} + /* Set DECL up to have the closest approximation of "initialized common" linkage available. */ @@ -1888,6 +1899,9 @@ comdat_linkage (tree decl) if (TREE_PUBLIC (decl)) DECL_COMDAT (decl) = 1; + + if (VAR_P (decl)) + adjust_var_decl_tls_model (decl); } /* For win32 we also want to put explicit instantiations in @@ -1926,6 +1940,8 @@ maybe_make_one_only (tree decl) /* Mark it needed so we don't forget to emit it. */ node->forced_by_abi = true; TREE_USED (decl) = 1; + + adjust_var_decl_tls_model (decl); } } } |