patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch
changeset 19 d80e6dedcc13
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch	Mon Mar 12 18:59:31 2007 +0000
     1.3 @@ -0,0 +1,96 @@
     1.4 +2002-04-20  Jakub Jelinek  <jakub@redhat.com>
     1.5 +
     1.6 +	* elf32-sparc.c (elf32_sparc_relocate_section): Find real output
     1.7 +	section with SEC_MERGE.
     1.8 +	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
     1.9 +
    1.10 +--- binutils/bfd/elf32-sparc.c.jj	Sat Apr 20 22:11:57 2002
    1.11 ++++ binutils/bfd/elf32-sparc.c	Sat Apr 20 23:06:33 2002
    1.12 +@@ -1144,7 +1144,7 @@ elf32_sparc_relocate_section (output_bfd
    1.13 +       struct elf_link_hash_entry *h;
    1.14 +       Elf_Internal_Sym *sym;
    1.15 +       asection *sec;
    1.16 +-      bfd_vma relocation, off;
    1.17 ++      bfd_vma relocation, off, orig_addend = 0;
    1.18 +       bfd_reloc_status_type r;
    1.19 +       boolean is_plt = false;
    1.20 +       boolean unresolved_reloc;
    1.21 +@@ -1192,6 +1192,7 @@ elf32_sparc_relocate_section (output_bfd
    1.22 + 	{
    1.23 + 	  sym = local_syms + r_symndx;
    1.24 + 	  sec = local_sections[r_symndx];
    1.25 ++	  orig_addend = rel->r_addend;
    1.26 + 	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
    1.27 + 	}
    1.28 +       else
    1.29 +@@ -1527,6 +1528,25 @@ elf32_sparc_relocate_section (output_bfd
    1.30 + 			  asection *osec;
    1.31 + 
    1.32 + 			  osec = sec->output_section;
    1.33 ++			  /* FIXME: As soon as making sections zero size
    1.34 ++			     is possible, this if can go away.  */
    1.35 ++			  if (bfd_is_abs_section (osec)
    1.36 ++			      && h == NULL
    1.37 ++			      && (sec->flags & SEC_MERGE)
    1.38 ++			      && ELF_ST_TYPE (sym->st_info) == STT_SECTION
    1.39 ++			      && (elf_section_data (sec)->sec_info_type
    1.40 ++				  == ELF_INFO_TYPE_MERGE))
    1.41 ++			    {
    1.42 ++			      asection *msec;
    1.43 ++
    1.44 ++			      msec = sec;
    1.45 ++			      _bfd_merged_section_offset (output_bfd, &msec,
    1.46 ++					elf_section_data (sec)->sec_info,
    1.47 ++					sym->st_value + orig_addend,
    1.48 ++					(bfd_vma) 0);
    1.49 ++			      osec = msec->output_section;
    1.50 ++			     }
    1.51 ++
    1.52 + 			  indx = elf_section_data (osec)->dynindx;
    1.53 + 
    1.54 + 			  /* FIXME: we really should be able to link non-pic
    1.55 +--- binutils/bfd/elf64-sparc.c.jj	Sat Apr 20 22:11:57 2002
    1.56 ++++ binutils/bfd/elf64-sparc.c	Sat Apr 20 23:12:18 2002
    1.57 +@@ -1939,7 +1939,7 @@ sparc64_elf_relocate_section (output_bfd
    1.58 +       struct elf_link_hash_entry *h;
    1.59 +       Elf_Internal_Sym *sym;
    1.60 +       asection *sec;
    1.61 +-      bfd_vma relocation, off;
    1.62 ++      bfd_vma relocation, off, orig_addend = 0;
    1.63 +       bfd_reloc_status_type r;
    1.64 +       boolean is_plt = false;
    1.65 +       boolean unresolved_reloc;
    1.66 +@@ -1982,6 +1982,7 @@ sparc64_elf_relocate_section (output_bfd
    1.67 + 	{
    1.68 + 	  sym = local_syms + r_symndx;
    1.69 + 	  sec = local_sections[r_symndx];
    1.70 ++	  orig_addend = rel->r_addend;
    1.71 + 	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
    1.72 + 	}
    1.73 +       else
    1.74 +@@ -2211,6 +2212,25 @@ sparc64_elf_relocate_section (output_bfd
    1.75 + 			    asection *osec;
    1.76 + 
    1.77 + 			    osec = sec->output_section;
    1.78 ++			    /* FIXME: As soon as making sections zero size
    1.79 ++			       is possible, this if can go away.  */
    1.80 ++			    if (bfd_is_abs_section (osec)
    1.81 ++				&& h == NULL
    1.82 ++				&& (sec->flags & SEC_MERGE)
    1.83 ++				&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
    1.84 ++				&& (elf_section_data (sec)->sec_info_type
    1.85 ++				    == ELF_INFO_TYPE_MERGE))
    1.86 ++			      {
    1.87 ++				asection *msec;
    1.88 ++
    1.89 ++				msec = sec;
    1.90 ++				_bfd_merged_section_offset (output_bfd, &msec,
    1.91 ++					elf_section_data (sec)->sec_info,
    1.92 ++					sym->st_value + orig_addend,
    1.93 ++					(bfd_vma) 0);
    1.94 ++				osec = msec->output_section;
    1.95 ++			      }
    1.96 ++
    1.97 + 			    indx = elf_section_data (osec)->dynindx;
    1.98 + 
    1.99 + 			    /* FIXME: we really should be able to link non-pic