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

Collapse All | Expand All

(-)ld/plugin.c (-3 / +24 lines)
Lines 278-283 asymbol_from_plugin_symbol (bfd *abfd, a Link Here
278
		? concat (ldsym->name, "@", ldsym->version, (const char *) NULL)
278
		? concat (ldsym->name, "@", ldsym->version, (const char *) NULL)
279
		: ldsym->name);
279
		: ldsym->name);
280
  asym->value = 0;
280
  asym->value = 0;
281
281
  switch (ldsym->def)
282
  switch (ldsym->def)
282
    {
283
    {
283
    case LDPK_WEAKDEF:
284
    case LDPK_WEAKDEF:
Lines 381-389 add_symbols (void *handle, int nsyms, co Link Here
381
  asymbol **symptrs;
382
  asymbol **symptrs;
382
  bfd *abfd = handle;
383
  bfd *abfd = handle;
383
  int n;
384
  int n;
385
  unsigned int entry;
386
384
  ASSERT (called_plugin);
387
  ASSERT (called_plugin);
388
385
  symptrs = xmalloc (nsyms * sizeof *symptrs);
389
  symptrs = xmalloc (nsyms * sizeof *symptrs);
386
  for (n = 0; n < nsyms; n++)
390
391
  for (entry = n = 0; n < nsyms; n++)
387
    {
392
    {
388
      enum ld_plugin_status rv;
393
      enum ld_plugin_status rv;
389
      asymbol *bfdsym;
394
      asymbol *bfdsym;
Lines 391-407 add_symbols (void *handle, int nsyms, co Link Here
391
      if (syms[n].comdat_key)
396
      if (syms[n].comdat_key)
392
	{
397
	{
393
	  struct already_linked linked;
398
	  struct already_linked linked;
399
400
	  /* FIXME: Is this the correct way to solve this problem ?
401
	     With COFF/PE based targets using COMDAT to detect already
402
	     created symbols via bfd_section_already_linked() does not
403
	     work.  Instead we checked the already linked list ourselves
404
	     and if the symbol is there, we do not add it to the symbol
405
	     table that we are creating.  */
406
	  if (bfd_get_flavour (abfd) == bfd_target_coff_flavour)
407
	    {
408
	      struct bfd_section_already_linked_hash_entry *already_linked_list;
409
410
	      already_linked_list = bfd_section_already_linked_table_lookup (syms[n].comdat_key);
411
	      if (already_linked_list != NULL && already_linked_list->entry != NULL)
412
		continue;
413
	    }
414
394
	  linked.comdat_key = xstrdup (syms[n].comdat_key);
415
	  linked.comdat_key = xstrdup (syms[n].comdat_key);
395
	  linked.u.abfd = abfd;
416
	  linked.u.abfd = abfd;
396
	  bfd_section_already_linked (abfd, &linked, &link_info);
417
	  bfd_section_already_linked (abfd, &linked, &link_info);
397
	}
418
	}
398
      bfdsym = bfd_make_empty_symbol (abfd);
419
      bfdsym = bfd_make_empty_symbol (abfd);
399
      symptrs[n] = bfdsym;
420
      symptrs[entry++] = bfdsym;
400
      rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n);
421
      rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n);
401
      if (rv != LDPS_OK)
422
      if (rv != LDPS_OK)
402
	return rv;
423
	return rv;
403
    }
424
    }
404
  bfd_set_symtab (abfd, symptrs, nsyms);
425
 bfd_set_symtab (abfd, symptrs, entry);
405
  return LDPS_OK;
426
  return LDPS_OK;
406
}
427
}
407
428

Return to bug 12762