Fix check_relocs/gc_sweep_hook mismatch
authorAlan Modra <amodra@gmail.com>
Fri, 28 Feb 2014 04:08:27 +0000 (14:38 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 28 Feb 2014 04:08:27 +0000 (14:38 +1030)
PR ld/16643
* elflink.c (elf_gc_sweep): Call gc_sweep_hook for exactly
the same conditions we called check_relocs.

bfd/ChangeLog
bfd/elflink.c

index 472bc8939147afeb6236d2958c211c52de9e6a17..75a638c54da8a26ba7ac47f478d2c9e02f43b42e 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-28  Alan Modra  <amodra@gmail.com>
+
+       PR ld/16643
+       * elflink.c (elf_gc_sweep): Call gc_sweep_hook for exactly
+       the same conditions we called check_relocs.
+
 2014-02-27  Yuri Gribov  <y.gribov@samsung.com>
 
        * bfd-in.h: Add export of bfd_elf32_arm_use_long_plt.
index 28ccf535a79fd54123a232cf5baf2053f96c0216..47e48024385227028935a877cfb8be153ed5e912 100644 (file)
@@ -11992,7 +11992,9 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
             info we collected before.  */
          if (gc_sweep_hook
              && (o->flags & SEC_RELOC) != 0
-             && o->reloc_count > 0
+             && o->reloc_count != 0
+             && !((info->strip == strip_all || info->strip == strip_debugger)
+                  && (o->flags & SEC_DEBUGGING) != 0)
              && !bfd_is_abs_section (o->output_section))
            {
              Elf_Internal_Rela *internal_relocs;