View | Details | Raw Unified | Return to bug 20022 | Differences between
and this patch

Collapse All | Expand All

(-)a/bfd/elflink.c (-7 / +16 lines)
Lines 12294-12302 _bfd_elf_is_start_stop (const struct bfd_link_info *info, Link Here
12294
  asection *s;
12294
  asection *s;
12295
  const char *sec_name;
12295
  const char *sec_name;
12296
12296
12297
  sec_name = NULL;
12298
  if (strncmp (h->root.root.string, "__start_", 8) == 0)
12299
    sec_name = h->root.root.string + 8;
12300
  else if (strncmp (h->root.root.string, "__stop_", 7) == 0)
12301
    sec_name = h->root.root.string + 7;
12302
12297
  if (h->root.type != bfd_link_hash_undefined
12303
  if (h->root.type != bfd_link_hash_undefined
12298
      && h->root.type != bfd_link_hash_undefweak)
12304
      && h->root.type != bfd_link_hash_undefweak)
12299
    return NULL;
12305
    {
12306
      /* PR 20022 - If an orphan section is only referred to via relocation(s)
12307
	 that use the linker constructed start or stop symbols and garbage
12308
	 collection is enabled then it will be removed even if the
12309
	 relocations remain.  */
12310
      if (sec_name && info->gc_sections)
12311
	info->callbacks->einfo (_("%P: warning: garbage collection does not work with orphan section symbols, eg: %s\n"),
12312
				h->root.root.string);
12313
      return NULL;
12314
    }
12300
12315
12301
  s = h->root.u.undef.section;
12316
  s = h->root.u.undef.section;
12302
  if (s != NULL)
12317
  if (s != NULL)
Lines 12306-12317 _bfd_elf_is_start_stop (const struct bfd_link_info *info, Link Here
12306
      return s;
12321
      return s;
12307
    }
12322
    }
12308
12323
12309
  sec_name = NULL;
12310
  if (strncmp (h->root.root.string, "__start_", 8) == 0)
12311
    sec_name = h->root.root.string + 8;
12312
  else if (strncmp (h->root.root.string, "__stop_", 7) == 0)
12313
    sec_name = h->root.root.string + 7;
12314
12315
  if (sec_name != NULL && *sec_name != '\0')
12324
  if (sec_name != NULL && *sec_name != '\0')
12316
    {
12325
    {
12317
      bfd *i;
12326
      bfd *i;

Return to bug 20022