bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix for VTINHERIT relocs for xstormy16 toolchain


From: Nick Clifton
Subject: Fix for VTINHERIT relocs for xstormy16 toolchain
Date: 15 Jan 2002 11:57:08 +0000

Hi Guys,

  The xstormy16 toolchain is failing to generate VTINHERIT relocs
  correctly because they are held in a separate howto table and
  xstormy16_reloc_type_lookup fails to take this into account.

  I am applying the patch below to fix this and also to removes few
  minor compile time warnings when building xstormy16-elf-as.

Cheers
        Nick

bfd/ChangeLog
2002-01-15  Nick Clifton  <address@hidden>

        * elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'.
        (xstormy16_reloc_map): Initialise new field with correct howto
        table.
        (xstormy16_reloc_type_lookup): Use 'table' field to locate correct
        howto entry.

gas/ChangeLog
2002-01-15  Nick Clifton  <address@hidden>

        * config/tc-xstormy16.c: (xstormy16_fix_adjustable): Do not fix
        vtinherit relocs.
        (xstormy16_md_apply_fix3): Do not return a value.


Index: bfd/elf32-xstormy16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xstormy16.c,v
retrieving revision 1.2
diff -c -2 -p -r1.2 elf32-xstormy16.c
*** elf32-xstormy16.c   2001/12/17 00:52:35     1.2
--- elf32-xstormy16.c   2002/01/15 11:50:16
*************** Foundation, Inc., 59 Temple Place - Suit
*** 23,26 ****
--- 23,27 ----
  #include "elf-bfd.h"
  #include "elf/xstormy16.h"
+ #include "libiberty.h"
  
  /* Forward declarations.  */
*************** static reloc_howto_type xstormy16_elf_ho
*** 246,269 ****
  /* Map BFD reloc types to XSTORMY16 ELF reloc types.  */
  
! struct xstormy16_reloc_map
  {
!   bfd_reloc_code_real_type bfd_reloc_val;
!   unsigned int xstormy16_reloc_val;
! };
  
! static const struct xstormy16_reloc_map xstormy16_reloc_map [] =
  {
!   { BFD_RELOC_NONE,                 R_XSTORMY16_NONE },
!   { BFD_RELOC_32,                   R_XSTORMY16_32 },
!   { BFD_RELOC_16,                   R_XSTORMY16_16 },
!   { BFD_RELOC_8,                    R_XSTORMY16_8 },
!   { BFD_RELOC_32_PCREL,             R_XSTORMY16_PC32 },
!   { BFD_RELOC_16_PCREL,             R_XSTORMY16_PC16 },
!   { BFD_RELOC_8_PCREL,              R_XSTORMY16_PC8 },
!   { BFD_RELOC_XSTORMY16_REL_12,      R_XSTORMY16_REL_12 },
!   { BFD_RELOC_XSTORMY16_24,       R_XSTORMY16_24 },
!   { BFD_RELOC_XSTORMY16_FPTR16,           R_XSTORMY16_FPTR16 },
!   { BFD_RELOC_VTABLE_INHERIT,       R_XSTORMY16_GNU_VTINHERIT },
!   { BFD_RELOC_VTABLE_ENTRY,         R_XSTORMY16_GNU_VTENTRY },
  };
  
--- 247,271 ----
  /* Map BFD reloc types to XSTORMY16 ELF reloc types.  */
  
! typedef struct xstormy16_reloc_map
  {
!   bfd_reloc_code_real_type  bfd_reloc_val;
!   unsigned int              xstormy16_reloc_val;
!   reloc_howto_type *        table;
! } reloc_map;
  
! static const reloc_map xstormy16_reloc_map [] =
  {
!   { BFD_RELOC_NONE,                 R_XSTORMY16_NONE,          
xstormy16_elf_howto_table },
!   { BFD_RELOC_32,                   R_XSTORMY16_32,            
xstormy16_elf_howto_table },
!   { BFD_RELOC_16,                   R_XSTORMY16_16,            
xstormy16_elf_howto_table },
!   { BFD_RELOC_8,                    R_XSTORMY16_8,             
xstormy16_elf_howto_table },
!   { BFD_RELOC_32_PCREL,             R_XSTORMY16_PC32,          
xstormy16_elf_howto_table },
!   { BFD_RELOC_16_PCREL,             R_XSTORMY16_PC16,          
xstormy16_elf_howto_table },
!   { BFD_RELOC_8_PCREL,              R_XSTORMY16_PC8,           
xstormy16_elf_howto_table },
!   { BFD_RELOC_XSTORMY16_REL_12,     R_XSTORMY16_REL_12,        
xstormy16_elf_howto_table },
!   { BFD_RELOC_XSTORMY16_24,       R_XSTORMY16_24,            
xstormy16_elf_howto_table },
!   { BFD_RELOC_XSTORMY16_FPTR16,           R_XSTORMY16_FPTR16,        
xstormy16_elf_howto_table },
!   { BFD_RELOC_VTABLE_INHERIT,       R_XSTORMY16_GNU_VTINHERIT, 
xstormy16_elf_howto_table2 },
!   { BFD_RELOC_VTABLE_ENTRY,         R_XSTORMY16_GNU_VTENTRY,   
xstormy16_elf_howto_table2 },
  };
  
*************** xstormy16_reloc_type_lookup (abfd, code)
*** 275,282 ****
    unsigned int i;
  
!   for (i = sizeof (xstormy16_reloc_map) / sizeof (xstormy16_reloc_map[0]);
!        --i;)
!     if (xstormy16_reloc_map [i].bfd_reloc_val == code)
!       return & xstormy16_elf_howto_table 
[xstormy16_reloc_map[i].xstormy16_reloc_val];
    
    return NULL;
--- 277,290 ----
    unsigned int i;
  
!   for (i = ARRAY_SIZE (xstormy16_reloc_map); --i;)
!     {
!       const reloc_map * entry;
! 
!       entry = xstormy16_reloc_map + i;
! 
!       if (entry->bfd_reloc_val == code)
!       return entry->table + (entry->xstormy16_reloc_val
!                              - entry->table[0].type);
!     }
    
    return NULL;

Index: gas/config/tc-xstormy16.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xstormy16.c,v
retrieving revision 1.1
diff -c -2 -p -r1.1 tc-xstormy16.c
*** tc-xstormy16.c      2001/12/08 03:45:55     1.1
--- tc-xstormy16.c      2002/01/15 11:50:16
*************** xstormy16_fix_adjustable (fixP)
*** 401,404 ****
--- 401,409 ----
      return 0;
    
+   /* We need the symbol name for the VTABLE entries.  */
+   if (   fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+       || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+     return 0;
+ 
    return ! xstormy16_force_relocation (fixP);
  }
*************** xstormy16_md_apply_fix3 (fixP, valueP, s
*** 514,518 ****
  
        if (fixP->fx_done)
!       return 1;
  
        /* The operand isn't fully resolved.  Determine a BFD reloc value
--- 519,523 ----
  
        if (fixP->fx_done)
!       return;
  
        /* The operand isn't fully resolved.  Determine a BFD reloc value
*************** xstormy16_md_apply_fix3 (fixP, valueP, s
*** 531,535 ****
                        _("unresolved expression that must be resolved"));
          fixP->fx_done = 1;
!         return 1;
        }
      }
--- 536,540 ----
                        _("unresolved expression that must be resolved"));
          fixP->fx_done = 1;
!         return;
        }
      }
*************** xstormy16_md_apply_fix3 (fixP, valueP, s
*** 579,584 ****
       This field is misnamed (or misused :-).  */
    fixP->fx_addnumber = value;
- 
-   return 1;
  }
  
--- 584,587 ----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]