public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/94659] New: Missing symbol with LTO and target_clones
@ 2020-04-19 14:42 yyc1992 at gmail dot com
  2020-04-20  7:09 ` [Bug lto/94659] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: yyc1992 at gmail dot com @ 2020-04-19 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

            Bug ID: 94659
           Summary: Missing symbol with LTO and target_clones
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yyc1992 at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

This is basically the same as
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80732 except now it only happens
with LTO enabled.

It seems that if a function with `target_clones` attribute isn't used in the
final library and if LTO is enabled, the function will be missing from the
resulting library. Only the `.resolver` symbol appears.

The test code is

```
// b.c

__attribute__((target_clones("default,avx")))
int f1()
{
    return 2;
}
```

when compiled with `gcc -g -flto -O3 -fPIC b.c -shared -o libb-lto.so`, the
exported symbols available are,

```
$ objdump -T libb-lto.so

libb-lto.so:     file format elf64-x86-64

DYNAMIC SYMBOL TABLE:
0000000000000000  w   D  *UND*  0000000000000000             
_ITM_deregisterTMCloneTable
0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__
0000000000000000  w   D  *UND*  0000000000000000             
_ITM_registerTMCloneTable
0000000000000000  w   DF *UND*  0000000000000000  GLIBC_2.2.5 __cxa_finalize
0000000000001730 g    DF .text  000000000000002b  Base        f1.resolver
```

Compared to the output lilbrary from `gcc -g -O3 -fPIC b.c -shared -o libb.so`

```
$ objdump -T libb.so

libb.so:     file format elf64-x86-64

DYNAMIC SYMBOL TABLE:
0000000000000000  w   D  *UND*  0000000000000000             
_ITM_deregisterTMCloneTable
0000000000000000  w   D  *UND*  0000000000000000              __gmon_start__
0000000000000000  w   D  *UND*  0000000000000000             
_ITM_registerTMCloneTable
0000000000000000  w   DF *UND*  0000000000000000  GLIBC_2.2.5 __cxa_finalize
0000000000001730  w   DF .text  000000000000002b  Base        f1.resolver
0000000000001730 g   iD  .text  000000000000002b  Base        f1
```

The exported symbol has the wrong name for the LTO version. `dlsym` result
confirms the difference.

If the function is used somewhere else in the library, the resulting symbol
will then looks the same as the non-LTO version.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] Missing symbol with LTO and target_clones
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
@ 2020-04-20  7:09 ` marxin at gcc dot gnu.org
  2020-04-20  7:20 ` [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-20  7:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-04-20

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, working on that..

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
  2020-04-20  7:09 ` [Bug lto/94659] " marxin at gcc dot gnu.org
@ 2020-04-20  7:20 ` marxin at gcc dot gnu.org
  2020-04-20  8:42 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-20  7:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |
            Summary|Missing symbol with LTO and |[8/9/10 Regression] Missing
                   |target_clones               |symbol with LTO and
                   |                            |target_clones since
                   |                            |r8-1461-g871cc215f7507cbe
   Target Milestone|---                         |10.0

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r8-1461-g871cc215f7507cbe.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
  2020-04-20  7:09 ` [Bug lto/94659] " marxin at gcc dot gnu.org
  2020-04-20  7:20 ` [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe marxin at gcc dot gnu.org
@ 2020-04-20  8:42 ` marxin at gcc dot gnu.org
  2020-04-21 19:15 ` law at redhat dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-20  8:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
I've got a patch candidate, testing right now.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
                   ` (2 preceding siblings ...)
  2020-04-20  8:42 ` marxin at gcc dot gnu.org
@ 2020-04-21 19:15 ` law at redhat dot com
  2020-04-21 19:16 ` law at redhat dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2020-04-21 19:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
                   ` (3 preceding siblings ...)
  2020-04-21 19:15 ` law at redhat dot com
@ 2020-04-21 19:16 ` law at redhat dot com
  2020-04-27  4:44 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2020-04-21 19:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--- Comment #4 from Jeffrey A. Law <law at redhat dot com> ---
Whoops.  Didn't mean to change the priority on this BZ.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
                   ` (4 preceding siblings ...)
  2020-04-21 19:16 ` law at redhat dot com
@ 2020-04-27  4:44 ` cvs-commit at gcc dot gnu.org
  2020-04-27  4:46 ` [Bug lto/94659] [8/9 " marxin at gcc dot gnu.org
  2020-04-27  4:47 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-27  4:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:b9dbb436b70938ca2b1ddf0cf2d5ffe2e5725dea

commit r10-7982-gb9dbb436b70938ca2b1ddf0cf2d5ffe2e5725dea
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Apr 27 06:44:29 2020 +0200

    Do not remove ifunc_resolver in LTO.

            PR lto/94659
            * cgraph.h (cgraph_node::can_remove_if_no_direct_calls_and_refs_p):
            Do not remove ifunc_resolvers in remove unreachable nodes in LTO.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
                   ` (5 preceding siblings ...)
  2020-04-27  4:44 ` cvs-commit at gcc dot gnu.org
@ 2020-04-27  4:46 ` marxin at gcc dot gnu.org
  2020-04-27  4:47 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-27  4:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.0
            Summary|[8/9/10 Regression] Missing |[8/9 Regression] Missing
                   |symbol with LTO and         |symbol with LTO and
                   |target_clones since         |target_clones since
                   |r8-1461-g871cc215f7507cbe   |r8-1461-g871cc215f7507cbe

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug lto/94659] [8/9 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe
  2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
                   ` (6 preceding siblings ...)
  2020-04-27  4:46 ` [Bug lto/94659] [8/9 " marxin at gcc dot gnu.org
@ 2020-04-27  4:47 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-27  4:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94659

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
GCC 10 will be released soon, I'm not planning to do a backport.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-04-27  4:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 14:42 [Bug lto/94659] New: Missing symbol with LTO and target_clones yyc1992 at gmail dot com
2020-04-20  7:09 ` [Bug lto/94659] " marxin at gcc dot gnu.org
2020-04-20  7:20 ` [Bug lto/94659] [8/9/10 Regression] Missing symbol with LTO and target_clones since r8-1461-g871cc215f7507cbe marxin at gcc dot gnu.org
2020-04-20  8:42 ` marxin at gcc dot gnu.org
2020-04-21 19:15 ` law at redhat dot com
2020-04-21 19:16 ` law at redhat dot com
2020-04-27  4:44 ` cvs-commit at gcc dot gnu.org
2020-04-27  4:46 ` [Bug lto/94659] [8/9 " marxin at gcc dot gnu.org
2020-04-27  4:47 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).