aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Tietz <ktietz70@googlemail.com>2015-10-02 08:06:52 +0000
committerKai Tietz <ktietz@gcc.gnu.org>2015-10-02 10:06:52 +0200
commit63578ef993cb48654a6525b5529af6c1c569c6b2 (patch)
treeb500bce9a64bd45d610be02e0e9867fb72172581
parent6a8b77b2fa3520d5f6e572b52cb68e53358dd677 (diff)
downloadgcc-63578ef993cb48654a6525b5529af6c1c569c6b2.zip
gcc-63578ef993cb48654a6525b5529af6c1c569c6b2.tar.gz
gcc-63578ef993cb48654a6525b5529af6c1c569c6b2.tar.bz2
re PR target/51726 (LTO and attribute 'selectany')
PR target/51726 * config/i386/winnt.c (ix86_handle_selectany_attribute): Handle selectany within this function without need to keep attribute. (i386_pe_encode_section_info): Remove selectany-code. From-SVN: r228370
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/winnt.c36
2 files changed, 20 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bcc33bd..b9d21ec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-02 Kai Tietz <ktietz70@googlemail.com>
+
+ PR target/51726
+ * config/i386/winnt.c (ix86_handle_selectany_attribute): Handle
+ selectany within this function without need to keep attribute.
+ (i386_pe_encode_section_info): Remove selectany-code.
+
2015-10-02 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (has_VN_INFO): New function.
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 362ef49..e9efec0 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -89,17 +89,23 @@ tree
ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
bool *no_add_attrs)
{
+ tree decl = *node;
/* The attribute applies only to objects that are initialized and have
external linkage. However, we may not know about initialization
- until the language frontend has processed the decl. We'll check for
- initialization later in encode_section_info. */
- if (TREE_CODE (*node) != VAR_DECL || !TREE_PUBLIC (*node))
- {
- error ("%qE attribute applies only to initialized variables"
- " with external linkage", name);
- *no_add_attrs = true;
+ until the language frontend has processed the decl. Therefore
+ we make sure that variable isn't initialized as common. */
+ if (TREE_CODE (decl) != VAR_DECL || !TREE_PUBLIC (decl))
+ error ("%qE attribute applies only to initialized variables"
+ " with external linkage", name);
+ else
+ {
+ make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
+ /* A variable with attribute selectany never can be common. */
+ DECL_COMMON (decl) = 0;
}
+ /* We don't need to keep attribute itself. */
+ *no_add_attrs = true;
return NULL_TREE;
}
@@ -320,23 +326,7 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first)
switch (TREE_CODE (decl))
{
case FUNCTION_DECL:
- break;
-
case VAR_DECL:
- if (lookup_attribute ("selectany", DECL_ATTRIBUTES (decl)))
- {
- if (DECL_INITIAL (decl)
- /* If an object is initialized with a ctor, the static
- initialization and destruction code for it is present in
- each unit defining the object. The code that calls the
- ctor is protected by a link-once guard variable, so that
- the object still has link-once semantics, */
- || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))
- make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
- else
- error ("%q+D:'selectany' attribute applies only to "
- "initialized objects", decl);
- }
break;
default: