* coff-a29k.c (a29k_reloc): For R_IREL, don't left shift
authorIan Lance Taylor <ian@airs.com>
Fri, 19 Nov 1993 19:51:52 +0000 (19:51 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 19 Nov 1993 19:51:52 +0000 (19:51 +0000)
signed_value before sign extending it.  Don't subtract out
reloc_entry->address.  This makes it compatible with what gas is
generating.

Fixes PR 3790.

bfd/ChangeLog
bfd/coff-a29k.c

index a63f12a4dc6dbc87db804df2e3ffb9d02d0f5e89..3f73fc044a7a445a5239e7cd8b6bb614918cd7e5 100644 (file)
@@ -1,5 +1,10 @@
 Fri Nov 19 14:34:04 1993  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
+       * coff-a29k.c (a29k_reloc): For R_IREL, don't left shift
+       signed_value before sign extending it.  Don't subtract out
+       reloc_entry->address.  This makes it compatible with what gas is
+       generating.
+
        * elfcode.h (elf_fake_sections): Accept .sbss as the name for a
        SHT_NOBITS sections.
        (map_program_segments): Don't leave the loop after the first
index 30924790b6edfdb17fc702d466f393073bfdb794..ef41bdbe725dd6cb2d8afd3dee18dcaf449c2370 100644 (file)
@@ -117,8 +117,9 @@ DEFUN(a29k_reloc,(abfd, reloc_entry, symbol_in, data, input_section, output_bfd)
    case R_IREL:        
     insn = bfd_get_32(abfd, hit_data); 
     /* Take the value in the field and sign extend it */
-    signed_value = EXTRACT_HWORD(insn) << 2;
+    signed_value = EXTRACT_HWORD(insn);
     signed_value = SIGN_EXTEND_HWORD(signed_value);
+    signed_value <<= 2;
     signed_value +=  sym_value + reloc_entry->addend;
     if ((signed_value&~0x3ffff) == 0) 
     {                          /* Absolute jmp/call */
@@ -129,9 +130,8 @@ DEFUN(a29k_reloc,(abfd, reloc_entry, symbol_in, data, input_section, output_bfd)
     {
       /* Relative jmp/call, so subtract from the value the
         address of the place we're coming from */
-      signed_value -= reloc_entry->address + 
-       input_section->output_section->vma + 
-       input_section->output_offset;
+      signed_value -= (input_section->output_section->vma
+                      + input_section->output_offset);
       if (signed_value>0x1ffff || signed_value<-0x20000) 
        return(bfd_reloc_outofrange);
     }