On 04/12/2018 03:46 PM, Jan Hubicka wrote:
2018-04-12 Martin Liska <[email protected]>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 <[email protected]> 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. 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
And Honza also asked me for description what has changes in between GCC 7.x and current trunk. There are test-cases that illustrate that: ./gcc/testsuite/gcc.target/i386/mvc10.c ./gcc/testsuite/gcc.target/i386/mvc11.c ./gcc/testsuite/gcc.target/i386/mvc5.c ./gcc/testsuite/gcc.target/i386/mvc7.c ./gcc/testsuite/gcc.target/i386/pr80732.c ./gcc/testsuite/gcc.target/i386/pr81214.c Martin
