Summary: | --gc-sections doesn't remove symbols hidden with version scripts | ||
---|---|---|---|
Product: | binutils | Reporter: | Mike Hommey <mh-sourceware> |
Component: | ld | Assignee: | unassigned |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | d.g.gorbachev, hjl.tools, prr |
Priority: | P2 | ||
Version: | 2.22 | ||
Target Milestone: | --- | ||
URL: | http://sourceware.org/ml/binutils/2011-09/msg00089.html | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Mike Hommey
2011-07-08 17:47:55 UTC
A patch is posted at http://sourceware.org/ml/binutils/2011-09/msg00079.html (In reply to comment #1) It would be even better if BFD LD could remove `bar' without --gc-sections but with lto. GOLD does it. An updated patch is posted at http://sourceware.org/ml/binutils/2011-09/msg00089.html (In reply to comment #3) Thank you! CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2011-09-16 01:15:20 Modified files: bfd : ChangeLog bfd-in.h bfd-in2.h elflink.c linker.c include : ChangeLog bfdlink.h ld : ChangeLog ldlang.c ldlang.h pe-dll.c plugin.c ld/emultempl : elf32.em solaris2.em ld/testsuite : ChangeLog Added files: ld/testsuite/ld-elf: pr12975.d pr12975.s pr12975.t Log message: Check if a symbol is hidden by linker script. bfd/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/12975 * bfd-in.h (bfd_elf_size_dynamic_sections): Remove pointer to struct bfd_elf_version_tree. * elflink.c (elf_info_failed): Remove verdefs. (_bfd_elf_export_symbol): Updated. _bfd_elf_link_assign_sym_version): Likewise. (bfd_elf_size_dynamic_sections): Remove pointer to struct bfd_elf_version_tree. Updated. (bfd_elf_gc_mark_dynamic_ref_symbol): Check if a symbol is hidden by linker script. * linker.c (bfd_hide_sym_by_version): New. * bfd-in2.h: Regenerated. include/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/12975 * bfdlink.h (bfd_link_info): Add version_info. ld/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/12975 * ldlang.c (lang_elf_version_info): Removed. (lang_register_vers_node): Replace lang_elf_version_info with link_info.version_info. (lang_add_vers_depend): Likewise. * pe-dll.c (process_def_file_and_drectve): Likewise. * emultempl/solaris2.em (elf_solaris2_before_allocation): Likewise. * ldlang.h (lang_elf_version_info): Removed. * plugin.c (is_visible_from_outside): Check if symbol is hidden by version script. * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Remove lang_elf_version_info. ld/testsuite/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR ld/12975 * ld-elf/pr12975.d: New. * ld-elf/pr12975.s: Likewise. * ld-elf/pr12975.t: Likewise. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5469&r2=1.5470 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in.h.diff?cvsroot=src&r1=1.157&r2=1.158 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/bfd-in2.h.diff?cvsroot=src&r1=1.548&r2=1.549 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elflink.c.diff?cvsroot=src&r1=1.418&r2=1.419 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/linker.c.diff?cvsroot=src&r1=1.89&r2=1.90 http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/ChangeLog.diff?cvsroot=src&r1=1.548&r2=1.549 http://sourceware.org/cgi-bin/cvsweb.cgi/src/include/bfdlink.h.diff?cvsroot=src&r1=1.91&r2=1.92 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2369&r2=1.2370 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.c.diff?cvsroot=src&r1=1.376&r2=1.377 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldlang.h.diff?cvsroot=src&r1=1.98&r2=1.99 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/pe-dll.c.diff?cvsroot=src&r1=1.137&r2=1.138 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/plugin.c.diff?cvsroot=src&r1=1.39&r2=1.40 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/elf32.em.diff?cvsroot=src&r1=1.222&r2=1.223 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emultempl/solaris2.em.diff?cvsroot=src&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1457&r2=1.1458 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/pr12975.d.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/pr12975.s.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-elf/pr12975.t.diff?cvsroot=src&r1=NONE&r2=1.1 I can't reproduce the original issue with recent GOLD (ver. 1.11/2.21.53.20110913) on i686-pc-linux-gnu. It still fails with BFD LD on i686-pc-mingw32 (with --gc-sections, but not with LTO). Fixed. CVSROOT: /cvs/src Module name: src Changes by: amodra@sourceware.org 2011-10-17 08:27:46 Modified files: bfd : ChangeLog elf64-ppc.c Log message: PR ld/12975 PR ld/13195 * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Apply 2011-09-15 and 2011-09-29 bfd_elf_gc_mark_dynamic_ref_symbol changes here too. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5490&r2=1.5491 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&r1=1.365&r2=1.366 CVSROOT: /cvs/src Module name: src Branch: binutils-2_22-branch Changes by: amodra@sourceware.org 2011-10-25 03:09:34 Modified files: bfd : ChangeLog elf64-ppc.c Log message: PR ld/12975 PR ld/13195 2011-10-17 Alan Modra <amodra@gmail.com> * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Apply 2011-09-15 and 2011-09-29 bfd_elf_gc_mark_dynamic_ref_symbol changes here too. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.5473.2.14&r2=1.5473.2.15 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-ppc.c.diff?cvsroot=src&only_with_tag=binutils-2_22-branch&r1=1.363.2.2&r2=1.363.2.3 |