Still a lot of bogus code; just a checkpoint.
[deliverable/binutils-gdb.git] / bfd / reloc.c
index 5675fbe616a58836e0c661a31004f6676b03c761..78a92416e8122807eac262636f6d7e8729110a3d 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD support for handling relocation entries.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
+   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -411,14 +411,14 @@ FUNCTION
        bfd_get_reloc_size
 
 SYNOPSIS
-       int bfd_get_reloc_size (reloc_howto_type *);
+       unsigned int bfd_get_reloc_size (reloc_howto_type *);
 
 DESCRIPTION
        For a reloc_howto_type that operates on a fixed number of bytes,
        this returns the number of bytes operated on.
  */
 
-int
+unsigned int
 bfd_get_reloc_size (howto)
      reloc_howto_type *howto;
 {
@@ -492,7 +492,8 @@ bfd_check_overflow (how, bitsize, rightshift, relocation)
     case complain_overflow_signed:
       {
        /* Assumes two's complement.  */
-       bfd_signed_vma reloc_signed_max = (1 << (bitsize - 1)) - 1;
+       bfd_signed_vma reloc_signed_max =
+         ((bfd_signed_vma) 1 << (bitsize - 1)) - 1;
        bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
 
        /* The above right shift is incorrect for a signed value.
@@ -513,7 +514,8 @@ bfd_check_overflow (how, bitsize, rightshift, relocation)
        /* Assumes two's complement.  This expression avoids
           overflow if `bitsize' is the number of bits in
           bfd_vma.  */
-       bfd_vma reloc_unsigned_max = (((1 << (bitsize - 1)) - 1) << 1) | 1;
+       bfd_vma reloc_unsigned_max =
+         ((((bfd_vma) 1 << (bitsize - 1)) - 1) << 1) | 1;
 
        if ((bfd_vma) check > reloc_unsigned_max)
          flag = bfd_reloc_overflow;
@@ -1345,8 +1347,9 @@ space consuming.  For each target:
    bfd_perform_relocation is so hacked up it is easier to write a new
    function than to try to deal with it.
 
-   This routine does a final relocation.  It should not be used when
-   generating relocateable output.
+   This routine does a final relocation.  Whether it is useful for a
+   relocateable link depends upon how the object format defines
+   relocations.
 
    FIXME: This routine ignores any special_function in the HOWTO,
    since the existing special_function values have been written for
@@ -1522,7 +1525,8 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
        case complain_overflow_signed:
          {
            /* Assumes two's complement.  */
-           bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1;
+           bfd_signed_vma reloc_signed_max =
+             ((bfd_signed_vma) 1 << (howto->bitsize - 1)) - 1;
            bfd_signed_vma reloc_signed_min = ~reloc_signed_max;
 
            if (signed_check > reloc_signed_max
@@ -1536,7 +1540,7 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
               overflow if howto->bitsize is the number of bits in
               bfd_vma.  */
            bfd_vma reloc_unsigned_max =
-           (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
+             ((((bfd_vma) 1 << (howto->bitsize - 1)) - 1) << 1) | 1;
 
            if (check > reloc_unsigned_max)
              overflow = true;
@@ -1864,6 +1868,11 @@ ENUMX
 ENUMDOC
   SPARC64 relocations
 
+ENUM
+  BFD_RELOC_SPARC_32LE
+ENUMDOC
+  SPARC little endian relocation
+
 ENUM
   BFD_RELOC_ALPHA_GPDISP_HI16
 ENUMDOC
@@ -2006,9 +2015,40 @@ ENUMX
   BFD_RELOC_MIPS_CALL_HI16
 ENUMX
   BFD_RELOC_MIPS_CALL_LO16
+COMMENT
+{* start-sanitize-r5900 *}
+ENUMX
+  BFD_RELOC_MIPS15_S3
+COMMENT
+{* end-sanitize-r5900 *}
 ENUMDOC
   MIPS ELF relocations.
 
+COMMENT
+{* start-sanitize-sky *}
+ENUM
+  BFD_RELOC_MIPS_DVP_11_PCREL
+ENUMDOC
+  MIPS DVP Relocations.
+  This is an 11-bit pc relative reloc.  The recorded address is for the
+  lower instruction word, and the value is in 128 bit units.
+ENUM
+  BFD_RELOC_MIPS_DVP_27_S4
+ENUMDOC
+  This is a 27 bit address left shifted by 4.
+ENUM
+  BFD_RELOC_MIPS_DVP_11_S4
+ENUMDOC
+  This is the 11 bit offset operand of ilw/stw instructions
+  left shifted by 4.
+ENUM
+  BFD_RELOC_MIPS_DVP_U15_S3
+ENUMDOC
+  This is the 15 bit unsigned immediate operand of the iaddiu instruction
+  left shifted by 3.
+COMMENT
+{* end-sanitize-sky *}
+
 ENUM
   BFD_RELOC_386_GOT32
 ENUMX
@@ -2229,7 +2269,6 @@ ENUMDOC
   stored in the instruction.  The high 24 bits are installed in bits 23
   through 0.
 
-COMMENT
 ENUM
   BFD_RELOC_D10V_10_PCREL_R
 ENUMDOC
@@ -2254,10 +2293,7 @@ ENUM
 ENUMDOC
   This is an 18-bit reloc with the right 2 bits
   assumed to be 0.
-COMMENT
 
-COMMENT
-{* start-sanitize-d30v *}
 ENUM
   BFD_RELOC_D30V_6
 ENUMDOC
@@ -2317,8 +2353,6 @@ ENUM
   BFD_RELOC_D30V_32_PCREL
 ENUMDOC
   This is a 32-bit pc-relative reloc.
-COMMENT
-{* end-sanitize-d30v *}
 
 ENUM
   BFD_RELOC_M32R_24
@@ -2445,16 +2479,35 @@ ENUMDOC
   This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
   instruction.
 
-COMMENT
-{* start-sanitize-sky *}
 ENUM
-  BFD_RELOC_TXVU_11_PCREL
+  BFD_RELOC_TIC30_LDP
 ENUMDOC
-  SKY TXVU Relocations.
-  This is an 11-bit pc relative reloc.  The recorded address is for the
-  lower instruction word.
-COMMENT
-{* end-sanitize-sky *}
+  This is a 8bit DP reloc for the tms320c30, where the most
+  significant 8 bits of a 24 bit word are placed into the least
+  significant 8 bits of the opcode.
+
+ENUM
+  BFD_RELOC_VTABLE_INHERIT
+ENUMX
+  BFD_RELOC_VTABLE_ENTRY
+ENUMDOC
+  These two relocations are used by the linker to determine which of 
+  the entries in a C++ virtual function table are actually used.  When
+  the --gc-sections option is given, the linker will zero out the entries
+  that are not used, so that the code for those functions need not be
+  included in the output.
+
+  VTABLE_INHERIT is a zero-space relocation used to describe to the
+  linker the inheritence tree of a C++ virtual function table.  The
+  relocation's symbol should be the parent class' vtable, and the
+  relocation should be located at the child vtable.
+
+  VTABLE_ENTRY is a zero-space relocation that describes the use of a
+  virtual function table entry.  The reloc's symbol should refer to the
+  table of the class mentioned in the code.  Off of that base, an offset
+  describes the entry that is being used.  For Rela hosts, this offset 
+  is stored in the reloc's addend.  For Rel hosts, we are forced to put
+  this offset in the reloc's section offset.
 
 ENDSENUM
   BFD_RELOC_UNUSED
@@ -2582,6 +2635,28 @@ bfd_generic_relax_section (abfd, section, link_info, again)
   return true;
 }
 
+/*
+INTERNAL_FUNCTION
+       bfd_generic_gc_sections
+
+SYNOPSIS
+       boolean bfd_generic_gc_sections
+        (bfd *, struct bfd_link_info *);
+
+DESCRIPTION
+       Provides default handling for relaxing for back ends which
+       don't do section gc -- i.e., does nothing.
+*/
+
+/*ARGSUSED*/
+boolean
+bfd_generic_gc_sections (abfd, link_info)
+     bfd *abfd;
+     struct bfd_link_info *link_info;
+{
+  return true;
+}
+
 /*
 INTERNAL_FUNCTION
        bfd_generic_get_relocated_section_contents
This page took 0.025936 seconds and 4 git commands to generate.