| commit 926: | 7c288cbdd8f1 |
| parent 925: | adbc724c8c94 |
| branch: | default |
Change the storage/export class for g++ guard variable
In previous implementation, it's GLOBAL and PREEMPTIBLE.
It will cause problems in static objects with the same name in
static functions with the same name in different TU.
In this patch, we change it to PSTATIC/LOCAL unless it's weak.
If it's weak, we still use GLOBAL/PREEMPTIBLE.
14 months ago
Changed (Δ61 bytes):
raw changeset »
osprey/wgen/wgen_spin_symbol.cxx (12 lines added, 8 lines removed)
Up to file-list osprey/wgen/wgen_spin_symbol.cxx:
| … | … | @@ -1766,15 +1766,17 @@ Create_ST_For_Tree (gs_t decl_node) |
1766 |
1766 |
} |
1767 |
1767 |
} |
1768 |
1768 |
} |
1769 |
// Make g++ guard variables global in order to make them weak. Ideally |
|
1770 |
// guard variables should be "common", but for some reason the back-end |
|
1771 |
// currently can't handle C++ commons. As a work around, make the |
|
1772 |
// guard variables weak. Since symtab_verify.cxx don't like weak |
|
1773 |
|
|
1769 |
// Make g++ guard variables local unless it's weak. |
|
1774 |
1770 |
if (guard_var) { |
1775 |
1771 |
level = GLOBAL_SYMTAB; |
1776 |
sclass = SCLASS_UGLOBAL; |
|
1777 |
eclass = EXPORT_PREEMPTIBLE; |
|
1772 |
if ( gs_decl_weak(decl_node) ) { |
|
1773 |
sclass = SCLASS_UGLOBAL; |
|
1774 |
eclass = EXPORT_PREEMPTIBLE; |
|
1775 |
} |
|
1776 |
else { |
|
1777 |
sclass = SCLASS_PSTATIC; |
|
1778 |
eclass = EXPORT_LOCAL; |
|
1779 |
} |
|
1778 |
1780 |
} |
1779 |
1781 |
|
1780 |
1782 |
// The tree under DECL_ARG_TYPE(decl_node) could reference decl_node. |
| … | … | @@ -1970,7 +1972,9 @@ Create_ST_For_Tree (gs_t decl_node) |
1970 |
1972 |
} |
1971 |
1973 |
// See comment above about guard variables. |
1972 |
1974 |
else if (guard_var) { |
1973 |
|
|
1975 |
if ( gs_decl_weak(decl_node) ) { |
|
1976 |
Set_ST_is_weak_symbol (st); |
|
1977 |
} |
|
1974 |
1978 |
Set_ST_init_value_zero (st); |
1975 |
1979 |
Set_ST_is_initialized (st); |
1976 |
1980 |
} |
