This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

d30v relocation fix


D30v is a RELA target, so there's no point in this chicanery.
This allows us to pass gcc testsuites.


r~

        * elf32-d30v.c (bfd_elf_d30v_reloc): Don't modify section
        contents when performing a partial link.
        (bfd_elf_d30v_reloc_21): Likewise.

Index: elf32-d30v.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-d30v.c,v
retrieving revision 1.3
diff -c -p -d -r1.3 elf32-d30v.c
*** elf32-d30v.c	2000/04/13 01:08:04	1.3
--- elf32-d30v.c	2000/04/21 17:24:09
*************** bfd_elf_d30v_reloc (abfd, reloc_entry, s
*** 287,292 ****
--- 287,299 ----
    reloc_howto_type *howto = reloc_entry->howto;
    int make_absolute = 0;
  
+   if (output_bfd != (bfd *) NULL)
+     {
+       /* Partial linking -- do nothing.  */
+       reloc_entry->address += input_section->output_offset;
+       return bfd_reloc_ok;
+     }
+ 
    r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                               input_section, output_bfd, error_message);
    if (r != bfd_reloc_continue)
*************** bfd_elf_d30v_reloc (abfd, reloc_entry, s
*** 314,324 ****
    reloc_target_output_section = symbol->section->output_section;
  
    /* Convert input-section-relative symbol value to absolute.  */
!   if (output_bfd)
!     output_base = 0;
!   else
!     output_base = reloc_target_output_section->vma;
! 
    relocation += output_base + symbol->section->output_offset;
  
    /* Add in supplied addend.  */
--- 321,327 ----
    reloc_target_output_section = symbol->section->output_section;
  
    /* Convert input-section-relative symbol value to absolute.  */
!   output_base = reloc_target_output_section->vma;
    relocation += output_base + symbol->section->output_offset;
  
    /* Add in supplied addend.  */
*************** bfd_elf_d30v_reloc (abfd, reloc_entry, s
*** 334,351 ****
        relocation -= tmp_addr;
      }
    
-   if (output_bfd != (bfd *) NULL)
-     {
-       /* This is a partial relocation, and we want to apply the relocation
- 	 to the reloc entry rather than the raw data. Modify the reloc
- 	 inplace to reflect what we now know.  */
-       reloc_entry->addend = relocation;
-       reloc_entry->address += input_section->output_offset;
-       return flag;
-     }
-   else
-     reloc_entry->addend = 0;
-   
    in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr);
    in2 = bfd_get_32 (abfd, (bfd_byte *) data + addr + 4);
  
--- 337,342 ----
*************** bfd_elf_d30v_reloc_21 (abfd, reloc_entry
*** 406,411 ****
--- 397,409 ----
    reloc_howto_type *howto = reloc_entry->howto;
    int mask, max;
  
+   if (output_bfd != (bfd *) NULL)
+     {
+       /* Partial linking -- do nothing.  */
+       reloc_entry->address += input_section->output_offset;
+       return bfd_reloc_ok;
+     }
+   
    r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
                               input_section, output_bfd, error_message);
    if (r != bfd_reloc_continue)
*************** bfd_elf_d30v_reloc_21 (abfd, reloc_entry
*** 433,443 ****
    reloc_target_output_section = symbol->section->output_section;
  
    /* Convert input-section-relative symbol value to absolute.  */
!   if (output_bfd)
!     output_base = 0;
!   else
!     output_base = reloc_target_output_section->vma;
! 
    relocation += output_base + symbol->section->output_offset;
  
    /* Add in supplied addend.  */
--- 431,437 ----
    reloc_target_output_section = symbol->section->output_section;
  
    /* Convert input-section-relative symbol value to absolute.  */
!   output_base = reloc_target_output_section->vma;
    relocation += output_base + symbol->section->output_offset;
  
    /* Add in supplied addend.  */
*************** bfd_elf_d30v_reloc_21 (abfd, reloc_entry
*** 448,470 ****
  
    if (howto->pc_relative == true)
      {
!       relocation -= input_section->output_section->vma + input_section->output_offset;
        if (howto->pcrel_offset == true)
  	relocation -= reloc_entry->address;
      }
  
-   if (output_bfd != (bfd *) NULL)
-     {
-       /* This is a partial relocation, and we want to apply the relocation
- 	 to the reloc entry rather than the raw data. Modify the reloc
- 	 inplace to reflect what we now know.  */
-       reloc_entry->addend = relocation;
-       reloc_entry->address += input_section->output_offset;
-       return flag;
-     }
-   else
-     reloc_entry->addend = 0;
-   
    in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr);
  
    mask =  (1 << howto->bitsize) - 1;
--- 442,453 ----
  
    if (howto->pc_relative == true)
      {
!       relocation -= (input_section->output_section->vma
! 		     + input_section->output_offset);
        if (howto->pcrel_offset == true)
  	relocation -= reloc_entry->address;
      }
  
    in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr);
  
    mask =  (1 << howto->bitsize) - 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]