Bug 94271 - [8/9 Regression] lto1: error: two or more sections for .gnu.lto_fast_clamp.default.9.564bf999b130b5e since r8-1461-g871cc215f7507cbe
Summary: [8/9 Regression] lto1: error: two or more sections for .gnu.lto_fast_clamp.de...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 10.0
: P2 normal
Target Milestone: 8.5
Assignee: Martin Liška
URL: https://gcc.gnu.org/pipermail/gcc-pat...
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2020-03-23 10:14 UTC by Martin Liška
Modified: 2020-03-31 10:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 10.0, 7.4.0
Known to fail: 8.4.0, 9.3.0
Last reconfirmed: 2020-03-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2020-03-23 10:14:57 UTC
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
Comment 1 Martin Liška 2020-03-23 10:15:52 UTC
I'm working on that..
Comment 2 Martin Liška 2020-03-23 13:23:38 UTC
Without LTO it fails to build with r10-6242-gc2bd2b4664be8b73.
Comment 3 GCC Commits 2020-03-25 10:04:01 UTC
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.
Comment 4 Martin Liška 2020-03-25 10:04:23 UTC
Fixed on master.
Comment 5 Rainer Orth 2020-03-26 09:08:41 UTC
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).
Comment 6 Martin Liška 2020-03-26 09:26:11 UTC
(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.
Comment 7 Martin Liška 2020-03-31 10:48:54 UTC
I tent to close it as I'm not planning any backports, target_clones is quite a fragile feature.