Summary: | Reference from dummy plugin symbol isn't removed | ||
---|---|---|---|
Product: | binutils | Reporter: | H.J. Lu <hjl.tools> |
Component: | ld | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fweimer, jakub |
Priority: | P2 | ||
Version: | 2.24 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
H.J. Lu
2013-02-13 18:01:24 UTC
CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2013-02-16 17:54:37 Modified files: ld : ChangeLog plugin.c ld/testsuite : ChangeLog ld/testsuite/ld-plugin: lto.exp bfd : ChangeLog elflink.c Added files: ld/testsuite/ld-plugin: pr15146.d pr15146a.c pr15146b.c pr15146d.c Log message: Don't add DT_NEEDED for references from the dummy bfd bfd/ PR ld/15146 * elflink.c (elf_link_add_object_symbols): Don't add DT_NEEDED for references from the dummy bfd. ld/ PR ld/15146 * plugin.c (plugin_notice): Replace the undefined dummy bfd with the real one. ld/testsuite/ PR ld/15146 * ld-plugin/pr15146.d: New file. * ld-plugin/pr15146a.c: Likewise. * ld-plugin/pr15146b.c: Likewise. * ld-plugin/pr15146c.c: Likewise. * ld-plugin/pr15146d.c: Likewise. * ld-plugin/lto.exp: Add tests for PR ld/15146. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2556&r2=1.2557 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.48&r2=1.49 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1686&r2=1.1687 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/pr15146.d.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/pr15146a.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/pr15146b.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/pr15146d.c.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/lto.exp.diff?cvsroot=src&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5969&r2=1.5970 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.468&r2=1.469 Fixed. CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2013-02-18 09:13:11 Modified files: ld/testsuite : ChangeLog ld/testsuite/ld-plugin: lto.exp Log message: * ld-plugin/lto.exp (Build pr15146b.so) Add -Wl,--no-as-needed. (PR ld/15146 (1), (2)): Likewise. (LTO 7): Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1687&r2=1.1688 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/lto.exp.diff?cvsroot=src&r1=1.4&r2=1.5 CVSROOT: /cvs/src Module name: src Changes by: sandra@sourceware.org 2013-02-19 03:59:09 Modified files: ld : ChangeLog plugin.c Log message: 2013-02-19 Sandra Loosemore <sandra@codesourcery.com> PR ld/15146 ld/ * plugin.c (plugin_notice): Add null check before dereferencing pointer. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2558&r2=1.2559 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.49&r2=1.50 CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2013-04-03 11:44:41 Modified files: ld/testsuite : ChangeLog ld/testsuite/ld-plugin: lto.exp pr12942a.cc Log message: PR ld/15227 * ld-plugin/lto.exp (PR ld/12942 (3)): Remove file name and line number from regexp. (PR ld/15146 (2)): Similarly. * ld-plugin/pr12942a.cc (main): Use __builtin_abort. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1704&r2=1.1705 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/lto.exp.diff?cvsroot=src&r1=1.7&r2=1.8 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-plugin/pr12942a.cc.diff?cvsroot=src&r1=1.1&r2=1.2 The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1e3b96fd6cf0c7d018083994ad951ccf92aba582 commit 1e3b96fd6cf0c7d018083994ad951ccf92aba582 Author: Alan Modra <amodra@gmail.com> Date: Fri Sep 4 13:54:21 2020 +0930 Allow plugin syms to mark as-needed shared libs needed We must tell LTO about symbols in all shared libraries loaded. That means we can't load extra shared libraries after LTO recompilation, at least, not those that affect the set of symbols that LTO cares about, the IR symbols. This change will likely result in complaints about --as-needed libraries being loaded unnecessarily, but being correct is more important than being optimal. One of the PR15146 tests regresses, and while that could be hidden by disabling the missing dso message by making it conditional on h->root.non_ir_ref_regular, that would just be sweeping a problem under the rug. bfd/ PR 15146 PR 26314 PR 26530 * elflink.c (elf_link_add_object_symbols): Do set def_regular and ref_regular for IR symbols. Don't clear dynsym, allowing IR symbols to load --as-needed shared libraries, but prevent IR symbols from becoming dynamic. ld/ * testsuite/ld-plugin/lto.exp: Don't run pr15146 tests. * testsuite/ld-plugin/pr15146.d: Delete. * testsuite/ld-plugin/pr15146a.c: Delete. * testsuite/ld-plugin/pr15146b.c: Delete. * testsuite/ld-plugin/pr15146c.c: Delete. * testsuite/ld-plugin/pr15146d.c: Delete. *** Bug 26806 has been marked as a duplicate of this bug. *** The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b1a92c635c1ec10fd703302ce1fc4ab3a8515a04 commit b1a92c635c1ec10fd703302ce1fc4ab3a8515a04 Author: Alan Modra <amodra@gmail.com> Date: Fri Oct 30 14:56:35 2020 +1030 PR26806, Suspected linker bug with LTO This patch reverts most of git commit 1e3b96fd6cf, so IR symbols are again not marked def_regular or ref_regular. That should be enough to stop IR symbols from becoming dynamic. To mark as-needed shared libraries referenced by IR symbols, use the referencing BFD rather than the ref flags. bfd/ PR 15146 PR 26314 PR 26530 PR 26806 * elflink.c (elf_link_add_object_symbols): Don't set def/ref flags for plugin syms. Do allow plugin syms to mark as-needed libs. ld/ PR 26806 * testsuite/ld-plugin/lto-19.h, * testsuite/ld-plugin/lto-19a.c, * testsuite/ld-plugin/lto-19b.c, * testsuite/ld-plugin/lto-19c.c: New test. * testsuite/ld-plugin/pr26806.c, * testsuite/ld-plugin/pr26806.d: New test. * testsuite/ld-plugin/lto.exp: Run them. The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=37707bd8221c2e3f7676de8bee0c42ce3ab38c77 commit 37707bd8221c2e3f7676de8bee0c42ce3ab38c77 Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Feb 4 05:11:37 2021 -0800 ld: Restore PR ld/15146 tests commit 7d409ac001cce916661d345bff01ed589991e762 Author: Alan Modra <amodra@gmail.com> Date: Thu Feb 4 13:56:34 2021 +1030 PR27311, (symbol from plugin): undefined reference, hidden sym fixed PR ld/15146. Restore PR ld/15146 tests. PR ld/15146 * testsuite/ld-plugin/lto.exp: Run PR ld/15146 tests. * testsuite/ld-plugin/pr15146.d: Restored. * testsuite/ld-plugin/pr15146a.c: Likewise. * testsuite/ld-plugin/pr15146b.c: Likewise. * testsuite/ld-plugin/pr15146c.c: Likewise. * testsuite/ld-plugin/pr15146d.c: Likewise. The binutils-2_36-branch branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3592ada38da455903b1ad2425c2c64849c4637fe commit 3592ada38da455903b1ad2425c2c64849c4637fe Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Feb 4 05:11:37 2021 -0800 ld: Restore PR ld/15146 tests commit 7d409ac001cce916661d345bff01ed589991e762 Author: Alan Modra <amodra@gmail.com> Date: Thu Feb 4 13:56:34 2021 +1030 PR27311, (symbol from plugin): undefined reference, hidden sym fixed PR ld/15146. Restore PR ld/15146 tests. PR ld/15146 * testsuite/ld-plugin/lto.exp: Run PR ld/15146 tests. * testsuite/ld-plugin/pr15146.d: Restored. * testsuite/ld-plugin/pr15146a.c: Likewise. * testsuite/ld-plugin/pr15146b.c: Likewise. * testsuite/ld-plugin/pr15146c.c: Likewise. * testsuite/ld-plugin/pr15146d.c: Likewise. (cherry picked from commit 37707bd8221c2e3f7676de8bee0c42ce3ab38c77) Fixed for 2.37 and 2.36 branch. Only 2.36 release doesn't work. |