On 04/12/2018 03:46 PM, Jan Hubicka wrote:
2018-04-12  Martin Liska  <mli...@suse.cz>

        PR ipa/85329
        * multiple_target.c (create_dispatcher_calls): Set apostrophes
        for target_clone error message.
        (separate_attrs): Add new argument and check for an emptry
        string.
        (expand_target_clones): Handle it.
        (ipa_target_clone): Make redirection just for target_clones
        functions.

gcc/testsuite/ChangeLog:

2018-04-12  Martin Liska  <mli...@suse.cz>

        PR ipa/85329
        * g++.dg/ext/pr85329.C: New test.
        * gcc.target/i386/mvc12.c: New test.
@@ -413,7 +426,11 @@ expand_target_clones (struct cgraph_node *node, bool 
definition)
    tree attributes = make_attribute ("target", "default",
                                    DECL_ATTRIBUTES (node->decl));
    DECL_ATTRIBUTES (node->decl) = attributes;
+  DECL_COMDAT (node->decl) = 0;
+  DECL_WEAK (node->decl) = 0;
+  DECL_ARTIFICIAL (node->decl) = 1;
    node->local.local = false;
+  node->set_comdat_group (NULL);

If you make C++ inline and get the idea to use target cloning attribute on this,
this will likely lead to link error if you compile multiple files because you
turn comdat to non-comdat.

Can you please explain this in more detail? Ideally showing a test-case that 
would fail?

Martin


For comdats this woudl effectivly need to become C++ abi extension and we would
need to define comdat sections for these.  Perhaps easiest way is to simply
reject the attribute on comdats and probaby also extern functions?

Otherwise patch looks OK.
Honza


Reply via email to