patches/binutils/2.13.90.0.2/rh62-binutils-2.11.93.0.2-sparc-nonpic.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 01 16:49:15 2007 +0000 (2007-05-01)
changeset 56 07a6a48962b7
permissions -rw-r--r--
Merge patches sent by Robert P. J. Day <rpjday@mindspring.com>.
Warning: the buildroot folks purposedly removed the skip-comment patch but didn't really said why. Keeping it for the sake of having it in svn just in case (removing it will be easier thant not having it at all).
     1 2002-04-20  Jakub Jelinek  <jakub@redhat.com>
     2 
     3 	* elf32-sparc.c (elf32_sparc_relocate_section): Find real output
     4 	section with SEC_MERGE.
     5 	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
     6 
     7 --- binutils/bfd/elf32-sparc.c.jj	Sat Apr 20 22:11:57 2002
     8 +++ binutils/bfd/elf32-sparc.c	Sat Apr 20 23:06:33 2002
     9 @@ -1144,7 +1144,7 @@ elf32_sparc_relocate_section (output_bfd
    10        struct elf_link_hash_entry *h;
    11        Elf_Internal_Sym *sym;
    12        asection *sec;
    13 -      bfd_vma relocation, off;
    14 +      bfd_vma relocation, off, orig_addend = 0;
    15        bfd_reloc_status_type r;
    16        boolean is_plt = false;
    17        boolean unresolved_reloc;
    18 @@ -1192,6 +1192,7 @@ elf32_sparc_relocate_section (output_bfd
    19  	{
    20  	  sym = local_syms + r_symndx;
    21  	  sec = local_sections[r_symndx];
    22 +	  orig_addend = rel->r_addend;
    23  	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
    24  	}
    25        else
    26 @@ -1527,6 +1528,25 @@ elf32_sparc_relocate_section (output_bfd
    27  			  asection *osec;
    28  
    29  			  osec = sec->output_section;
    30 +			  /* FIXME: As soon as making sections zero size
    31 +			     is possible, this if can go away.  */
    32 +			  if (bfd_is_abs_section (osec)
    33 +			      && h == NULL
    34 +			      && (sec->flags & SEC_MERGE)
    35 +			      && ELF_ST_TYPE (sym->st_info) == STT_SECTION
    36 +			      && (elf_section_data (sec)->sec_info_type
    37 +				  == ELF_INFO_TYPE_MERGE))
    38 +			    {
    39 +			      asection *msec;
    40 +
    41 +			      msec = sec;
    42 +			      _bfd_merged_section_offset (output_bfd, &msec,
    43 +					elf_section_data (sec)->sec_info,
    44 +					sym->st_value + orig_addend,
    45 +					(bfd_vma) 0);
    46 +			      osec = msec->output_section;
    47 +			     }
    48 +
    49  			  indx = elf_section_data (osec)->dynindx;
    50  
    51  			  /* FIXME: we really should be able to link non-pic
    52 --- binutils/bfd/elf64-sparc.c.jj	Sat Apr 20 22:11:57 2002
    53 +++ binutils/bfd/elf64-sparc.c	Sat Apr 20 23:12:18 2002
    54 @@ -1939,7 +1939,7 @@ sparc64_elf_relocate_section (output_bfd
    55        struct elf_link_hash_entry *h;
    56        Elf_Internal_Sym *sym;
    57        asection *sec;
    58 -      bfd_vma relocation, off;
    59 +      bfd_vma relocation, off, orig_addend = 0;
    60        bfd_reloc_status_type r;
    61        boolean is_plt = false;
    62        boolean unresolved_reloc;
    63 @@ -1982,6 +1982,7 @@ sparc64_elf_relocate_section (output_bfd
    64  	{
    65  	  sym = local_syms + r_symndx;
    66  	  sec = local_sections[r_symndx];
    67 +	  orig_addend = rel->r_addend;
    68  	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
    69  	}
    70        else
    71 @@ -2211,6 +2212,25 @@ sparc64_elf_relocate_section (output_bfd
    72  			    asection *osec;
    73  
    74  			    osec = sec->output_section;
    75 +			    /* FIXME: As soon as making sections zero size
    76 +			       is possible, this if can go away.  */
    77 +			    if (bfd_is_abs_section (osec)
    78 +				&& h == NULL
    79 +				&& (sec->flags & SEC_MERGE)
    80 +				&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
    81 +				&& (elf_section_data (sec)->sec_info_type
    82 +				    == ELF_INFO_TYPE_MERGE))
    83 +			      {
    84 +				asection *msec;
    85 +
    86 +				msec = sec;
    87 +				_bfd_merged_section_offset (output_bfd, &msec,
    88 +					elf_section_data (sec)->sec_info,
    89 +					sym->st_value + orig_addend,
    90 +					(bfd_vma) 0);
    91 +				osec = msec->output_section;
    92 +			      }
    93 +
    94  			    indx = elf_section_data (osec)->dynindx;
    95  
    96  			    /* FIXME: we really should be able to link non-pic