Since the revision we do not accept: $ cat 1.i int a; static inline int __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4"))) fast_clamp() {} void c() { a = fast_clamp(); } $ cat 2.i int aa; static inline int __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4"))) fast_clamp() {} void b() { aa = fast_clamp(); } int main() { return 0; } $ gcc 1.i 2.i -O2 -flto ... (.text+0x0): multiple definition of `fast_clamp'; /tmp/cc3Vv3xl.o (symbol from plugin):(.text+0x0): first defined here The situation is even worse since r10-6242-gc2bd2b4664be8b73f8fd58a64dec1e93871797cc: /usr/bin/ld: /tmp/ccwTYmhr.o (symbol from plugin): in function `main': (.text+0x0): multiple definition of `fast_clamp'; /tmp/ccdQcwap.o (symbol from plugin):(.text+0x0): first defined here 1.i:6:1: error: ‘fast_clamp’ has already been defined 6 | void c() { a = fast_clamp(); } | ^ 1.i:6:1: note: previously defined here lto1: fatal error: errors during merging of translation units compilation terminated. lto-wrapper: fatal error: gcc returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status
I'm working on that..
Without LTO it fails to build with r10-6242-gc2bd2b4664be8b73.
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:724ec02c2c6d1b79788be77f68ebb6ca7b5b6acd commit r10-7372-g724ec02c2c6d1b79788be77f68ebb6ca7b5b6acd Author: Martin Liska <mliska@suse.cz> Date: Wed Mar 25 11:03:39 2020 +0100 Make target_clones resolver fn static if possible. PR target/93274 PR ipa/94271 * config/i386/i386-features.c (make_resolver_func): Drop public flag for resolver. * config/rs6000/rs6000.c (make_resolver_func): Add comdat group for resolver and drop public flag if possible. * multiple_target.c (create_dispatcher_calls): Drop unique_name and resolution as we want to enable LTO privatization of the default symbol. PR target/93274 PR ipa/94271 * gcc.target/i386/pr81213-2.c: New test. * gcc.target/i386/pr81213.c: Add additional source. * gcc.dg/lto/pr94271_0.c: New test. * gcc.dg/lto/pr94271_1.c: New test.
Fixed on master.
Unfortunately, apart from PR testsuite/94334, the patch introduced another failure: +FAIL: gcc.target/i386/pr81213-2.c (test for excess errors) Excess errors: /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr81213-2.c:3:1: error: the call requires 'ifunc', which is not supported by this target on i386-pc-solaris2.11 (and probably others).
(In reply to Rainer Orth from comment #5) > Unfortunately, apart from PR testsuite/94334, the patch introduced another > failure: > > +FAIL: gcc.target/i386/pr81213-2.c (test for excess errors) > > Excess errors: > /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.target/i386/pr81213-2.c:3:1: > error: the call requires 'ifunc', which is not supported by this target > > on i386-pc-solaris2.11 (and probably others). Fixed with g:d6730f06420106af01e26414f046626b5292565d.
I tent to close it as I'm not planning any backports, target_clones is quite a fragile feature.