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

Collapse All | Expand All

(-)a/bfd/elf32-nios2.c (-26 / +10 lines)
Lines 4694-4714 static bfd_boolean Link Here
4694
nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
4694
nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
4695
			  asection *sec, const Elf_Internal_Rela *relocs)
4695
			  asection *sec, const Elf_Internal_Rela *relocs)
4696
{
4696
{
4697
  bfd *dynobj;
4698
  Elf_Internal_Shdr *symtab_hdr;
4697
  Elf_Internal_Shdr *symtab_hdr;
4699
  struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
4698
  struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
4700
  const Elf_Internal_Rela *rel;
4699
  const Elf_Internal_Rela *rel;
4701
  const Elf_Internal_Rela *rel_end;
4700
  const Elf_Internal_Rela *rel_end;
4702
  struct elf32_nios2_link_hash_table *htab;
4701
  struct elf32_nios2_link_hash_table *htab;
4703
  asection *sgot;
4704
  asection *srelgot;
4705
  asection *sreloc = NULL;
4702
  asection *sreloc = NULL;
4706
  bfd_signed_vma *local_got_refcounts;
4703
  bfd_signed_vma *local_got_refcounts;
4707
4704
4708
  if (bfd_link_relocatable (info))
4705
  if (bfd_link_relocatable (info))
4709
    return TRUE;
4706
    return TRUE;
4710
4707
4711
  dynobj = elf_hash_table (info)->dynobj;
4712
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
4708
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
4713
  sym_hashes = elf_sym_hashes (abfd);
4709
  sym_hashes = elf_sym_hashes (abfd);
4714
  sym_hashes_end = (sym_hashes
4710
  sym_hashes_end = (sym_hashes
Lines 4718-4725 nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, Link Here
4718
  local_got_refcounts = elf_local_got_refcounts (abfd);
4714
  local_got_refcounts = elf_local_got_refcounts (abfd);
4719
4715
4720
  htab = elf32_nios2_hash_table (info);
4716
  htab = elf32_nios2_hash_table (info);
4721
  sgot = htab->root.sgot;
4722
  srelgot = htab->root.srelgot;
4723
4717
4724
  rel_end = relocs + sec->reloc_count;
4718
  rel_end = relocs + sec->reloc_count;
4725
  for (rel = relocs; rel < rel_end; rel++)
4719
  for (rel = relocs; rel < rel_end; rel++)
Lines 4778-4801 nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, Link Here
4778
		break;
4772
		break;
4779
	      }
4773
	      }
4780
4774
4781
	    if (dynobj == NULL)
4775
	    if (htab->root.dynobj == NULL)
4782
	      {
4776
	      {
4783
		/* Create the .got section.  */
4777
		/* Create the .got section.  */
4784
		elf_hash_table (info)->dynobj = dynobj = abfd;
4778
		htab->root.dynobj = abfd;
4785
		nios2_elf32_create_dynamic_sections (dynobj, info);
4779
		nios2_elf32_create_dynamic_sections (htab->root.dynobj, info);
4786
	      }
4787
4788
	    if (sgot == NULL)
4789
	      {
4790
		sgot = htab->root.sgot;
4791
		BFD_ASSERT (sgot != NULL);
4792
	      }
4793
4794
	    if (srelgot == NULL
4795
		&& (h != NULL || bfd_link_pic (info)))
4796
	      {
4797
		srelgot = htab->root.srelgot;
4798
		BFD_ASSERT (srelgot != NULL);
4799
	      }
4780
	      }
4800
4781
4801
	    if (h != NULL)
4782
	    if (h != NULL)
Lines 4925-4932 nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info, Link Here
4925
		 section in dynobj and make room for this reloc.  */
4906
		 section in dynobj and make room for this reloc.  */
4926
	      if (sreloc == NULL)
4907
	      if (sreloc == NULL)
4927
		{
4908
		{
4909
		  if (htab->root.dynobj == NULL)
4910
		    htab->root.dynobj = abfd;
4911
4928
		  sreloc = _bfd_elf_make_dynamic_reloc_section
4912
		  sreloc = _bfd_elf_make_dynamic_reloc_section
4929
		    (sec, dynobj, 2, abfd, TRUE);
4913
		    (sec, htab->root.dynobj, 2, abfd, TRUE);
4930
		  if (sreloc == NULL)
4914
		  if (sreloc == NULL)
4931
		    return FALSE;
4915
		    return FALSE;
4932
		}
4916
		}
Lines 6003-6015 nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, Link Here
6003
	      s->reloc_count = 0;
5987
	      s->reloc_count = 0;
6004
	    }
5988
	    }
6005
	}
5989
	}
6006
      else if (s == htab->root.sgot
5990
      else if (s == htab->root.sgotplt)
6007
	       || s == htab->root.sgotplt)
6008
	{
5991
	{
6009
	  if (s->size != 0)
5992
	  if (s->size != 0)
6010
	    got = TRUE;
5993
	    got = TRUE;
6011
	}
5994
	}
6012
      else if (s != htab->root.sdynbss
5995
      else if (s != htab->root.sgot
5996
	       && s != htab->root.sdynbss
6013
	       && s != htab->root.sdynrelro)
5997
	       && s != htab->root.sdynrelro)
6014
	/* It's not one of our sections, so don't allocate space.  */
5998
	/* It's not one of our sections, so don't allocate space.  */
6015
	continue;
5999
	continue;

Return to bug 20995