public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "yyc1992 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/94659] New: Missing symbol with LTO and target_clones Date: Sun, 19 Apr 2020 14:42:37 +0000 [thread overview] Message-ID: <bug-94659-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2020-04-19 14:42 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-19 14:42 yyc1992 at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-94659-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).