Add MIPS ELF64 relocs
[deliverable/binutils-gdb.git] / bfd / reloc.c
index 77530a53e8d0374aec032d15302a5117a3879f8d..4fcab608bc071599fbc85c9965d56a7fc609f97d 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD support for handling relocation entries.
-   Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -146,7 +147,6 @@ DESCRIPTION
        to the relocation offset. Its interpretation is dependent upon
        the howto. For example, on the 68k the code:
 
-
 |        char foo[];
 |        main()
 |                {
@@ -161,11 +161,9 @@ DESCRIPTION
 |        unlk fp
 |        rts
 
-
         This could create a reloc pointing to <<foo>>, but leave the
         offset in the data, something like:
 
-
 |RELOCATION RECORDS FOR [.text]:
 |offset   type      value
 |00000006 32        _foo
@@ -176,21 +174,17 @@ DESCRIPTION
 |0000000c 4e5e               ; unlk fp
 |0000000e 4e75               ; rts
 
-
         Using coff and an 88k, some instructions don't have enough
         space in them to represent the full address range, and
         pointers have to be loaded in two parts. So you'd get something like:
 
-
 |        or.u     r13,r0,hi16(_foo+0x12345678)
 |        ld.b     r2,r13,lo16(_foo+0x12345678)
 |        jmp      r1
 
-
         This should create two relocs, both pointing to <<_foo>>, and with
         0x12340000 in their addend field. The data would consist of:
 
-
 |RELOCATION RECORDS FOR [.text]:
 |offset   type      value
 |00000002 HVRT16    _foo+0x12340000
@@ -200,7 +194,6 @@ DESCRIPTION
 |00000004 1c4d5678           ; ld.b r2,r13,0x5678
 |00000008 f400c001           ; jmp r1
 
-
         The relocation routine digs out the value from the data, adds
         it to the addend to get the original offset, and then adds the
         value of <<_foo>>. Note that all 32 bits have to be kept around
@@ -223,7 +216,6 @@ DESCRIPTION
         Both relocs contain a pointer to <<foo>>, and the offsets
         contain junk.
 
-
 |RELOCATION RECORDS FOR [.text]:
 |offset   type      value
 |00000004 HI22      _foo+0x12345678
@@ -235,7 +227,6 @@ DESCRIPTION
 |0000000c 81c7e008     ; ret
 |00000010 81e80000     ; restore
 
-
         o <<howto>>
 
         The <<howto>> field can be imagined as a
@@ -391,7 +382,6 @@ FUNCTION
 DESCRIPTION
        The HOWTO define is horrible and will go away.
 
-
 .#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
 .  {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
 
@@ -399,7 +389,6 @@ DESCRIPTION
        And will be replaced with the totally magic way. But for the
        moment, we are compatible, so do it this way.
 
-
 .#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
 .
 
@@ -589,7 +578,6 @@ DESCRIPTION
 
 */
 
-
 bfd_reloc_status_type
 bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
                        error_message)
@@ -651,7 +639,6 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
   else
     relocation = symbol->value;
 
-
   reloc_target_output_section = symbol->section->output_section;
 
   /* Convert input-section-relative symbol value to absolute.  */
@@ -728,9 +715,6 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
 
          /* WTF?? */
          if (abfd->xvec->flavour == bfd_target_coff_flavour
-             && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0
-             && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0
-             && strcmp (abfd->xvec->name, "xcoff-powermac") != 0
              && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
              && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
            {
@@ -993,7 +977,6 @@ DESCRIPTION
 
 */
 
-
 bfd_reloc_status_type
 bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
                        input_section, error_message)
@@ -1125,9 +1108,6 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
 
       /* WTF?? */
       if (abfd->xvec->flavour == bfd_target_coff_flavour
-         && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0
-         && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0
-         && strcmp (abfd->xvec->name, "xcoff-powermac") != 0
          && strcmp (abfd->xvec->name, "coff-Intel-little") != 0
          && strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
        {
@@ -1786,7 +1766,6 @@ displacements off that register.  These relocation types are
 handled specially, because the value the register will have is
 decided relatively late.
 
-
 ENUM
   BFD_RELOC_I960_CALLJ
 ENUMDOC
@@ -2058,6 +2037,28 @@ ENUMX
   BFD_RELOC_MIPS_GOT_OFST
 ENUMX
   BFD_RELOC_MIPS_GOT_DISP
+ENUMX
+  BFD_RELOC_MIPS_SHIFT5
+ENUMX
+  BFD_RELOC_MIPS_SHIFT6
+ENUMX
+  BFD_RELOC_MIPS_INSERT_A
+ENUMX
+  BFD_RELOC_MIPS_INSERT_B
+ENUMX
+  BFD_RELOC_MIPS_DELETE
+ENUMX
+  BFD_RELOC_MIPS_HIGHEST
+ENUMX
+  BFD_RELOC_MIPS_HIGHER
+ENUMX
+  BFD_RELOC_MIPS_SCN_DISP
+ENUMX
+  BFD_RELOC_MIPS_REL16
+ENUMX
+  BFD_RELOC_MIPS_RELGOT
+ENUMX
+  BFD_RELOC_MIPS_JALR
 COMMENT
 ENUMDOC
   MIPS ELF relocations.
@@ -2083,6 +2084,25 @@ ENUMX
 ENUMDOC
   i386/elf relocations
 
+ENUM
+  BFD_RELOC_X86_64_GOT32
+ENUMX
+  BFD_RELOC_X86_64_PLT32
+ENUMX
+  BFD_RELOC_X86_64_COPY
+ENUMX
+  BFD_RELOC_X86_64_GLOB_DAT
+ENUMX
+  BFD_RELOC_X86_64_JUMP_SLOT
+ENUMX
+  BFD_RELOC_X86_64_RELATIVE
+ENUMX
+  BFD_RELOC_X86_64_GOTPCREL
+ENUMX
+  BFD_RELOC_X86_64_32S
+ENUMDOC
+  x86-64/elf relocations
+
 ENUM
   BFD_RELOC_NS32K_IMM_8
 ENUMX
@@ -2110,6 +2130,13 @@ ENUMX
 ENUMDOC
   ns32k relocations
 
+ENUM
+  BFD_RELOC_PDP11_DISP_8_PCREL
+ENUMX
+  BFD_RELOC_PDP11_DISP_6_PCREL
+ENUMDOC
+  PDP11 relocations
+
 ENUM
   BFD_RELOC_PJ_CODE_HI16
 ENUMX
@@ -2313,6 +2340,16 @@ ENUMX
   BFD_RELOC_SH_LOOP_START
 ENUMX
   BFD_RELOC_SH_LOOP_END
+ENUMX
+  BFD_RELOC_SH_COPY
+ENUMX
+  BFD_RELOC_SH_GLOB_DAT
+ENUMX
+  BFD_RELOC_SH_JMP_SLOT
+ENUMX
+  BFD_RELOC_SH_RELATIVE
+ENUMX
+  BFD_RELOC_SH_GOTPC
 ENUMDOC
   Hitachi SH relocs.  Not all of these appear in object files.
 
@@ -2329,7 +2366,7 @@ ENUMDOC
 ENUM
   BFD_RELOC_ARC_B22_PCREL
 ENUMDOC
-  Argonaut RISC Core (ARC) relocs.
+  ARC Cores relocs.
   ARC 22 bit pc-relative branch.  The lowest two bits must be zero and are
   not stored in the instruction.  The high 20 bits are installed in bits 26
   through 7 of the instruction.
@@ -2577,15 +2614,15 @@ ENUMDOC
 ENUM
   BFD_RELOC_TIC54X_16_OF_23
 ENUMDOC
-  This is a 16-bit reloc for the tms320c54x, where the least 
-  significant 16 bits of a 23-bit extended address are placed into 
+  This is a 16-bit reloc for the tms320c54x, where the least
+  significant 16 bits of a 23-bit extended address are placed into
   the opcode.
 
 ENUM
   BFD_RELOC_TIC54X_MS7_OF_23
 ENUMDOC
   This is a reloc for the tms320c54x, where the most
-  significant 7 bits of a 23-bit extended address are placed into 
+  significant 7 bits of a 23-bit extended address are placed into
   the opcode.
 
 ENUM
@@ -2657,7 +2694,7 @@ ENUM
   BFD_RELOC_AVR_16_PM
 ENUMDOC
   This is a 16 bit reloc for the AVR that stores 17 bit value (usually
-  program memory address) into 16 bits.  
+  program memory address) into 16 bits.
 ENUM
   BFD_RELOC_AVR_LO8_LDI
 ENUMDOC
@@ -2728,6 +2765,75 @@ ENUMDOC
   This is a 32 bit reloc for the AVR that stores 23 bit value
   into 22 bits.
 
+ENUM
+  BFD_RELOC_390_12
+ENUMDOC
+   Direct 12 bit.
+ENUM
+  BFD_RELOC_390_GOT12
+ENUMDOC
+  12 bit GOT offset.
+ENUM
+  BFD_RELOC_390_PLT32
+ENUMDOC
+  32 bit PC relative PLT address.
+ENUM
+  BFD_RELOC_390_COPY
+ENUMDOC
+  Copy symbol at runtime.
+ENUM
+  BFD_RELOC_390_GLOB_DAT
+ENUMDOC
+  Create GOT entry.
+ENUM
+  BFD_RELOC_390_JMP_SLOT
+ENUMDOC
+  Create PLT entry.
+ENUM
+  BFD_RELOC_390_RELATIVE
+ENUMDOC
+  Adjust by program base.
+ENUM
+  BFD_RELOC_390_GOTPC
+ENUMDOC
+  32 bit PC relative offset to GOT.
+ENUM
+  BFD_RELOC_390_GOT16
+ENUMDOC
+  16 bit GOT offset.
+ENUM
+  BFD_RELOC_390_PC16DBL
+ENUMDOC
+  PC relative 16 bit shifted by 1.
+ENUM
+  BFD_RELOC_390_PLT16DBL
+ENUMDOC
+  16 bit PC rel. PLT shifted by 1.
+ENUM
+  BFD_RELOC_390_PC32DBL
+ENUMDOC
+  PC relative 32 bit shifted by 1.
+ENUM
+  BFD_RELOC_390_PLT32DBL
+ENUMDOC
+  32 bit PC rel. PLT shifted by 1.
+ENUM
+  BFD_RELOC_390_GOTPCDBL
+ENUMDOC
+  32 bit PC rel. GOT shifted by 1.
+ENUM
+  BFD_RELOC_390_GOT64
+ENUMDOC
+  64 bit GOT offset.
+ENUM
+  BFD_RELOC_390_PLT64
+ENUMDOC
+  64 bit PC relative PLT address.
+ENUM
+  BFD_RELOC_390_GOTENT
+ENUMDOC
+  32 bit rel. offset to GOT entry.
+                  
 ENUM
   BFD_RELOC_VTABLE_INHERIT
 ENUMX
@@ -2801,10 +2907,18 @@ ENUMX
   BFD_RELOC_IA64_FPTR64LSB
 ENUMX
   BFD_RELOC_IA64_PCREL21B
+ENUMX
+  BFD_RELOC_IA64_PCREL21BI
 ENUMX
   BFD_RELOC_IA64_PCREL21M
 ENUMX
   BFD_RELOC_IA64_PCREL21F
+ENUMX
+  BFD_RELOC_IA64_PCREL22
+ENUMX
+  BFD_RELOC_IA64_PCREL60B
+ENUMX
+  BFD_RELOC_IA64_PCREL64I
 ENUMX
   BFD_RELOC_IA64_PCREL32MSB
 ENUMX
@@ -2821,8 +2935,6 @@ ENUMX
   BFD_RELOC_IA64_LTOFF_FPTR64MSB
 ENUMX
   BFD_RELOC_IA64_LTOFF_FPTR64LSB
-ENUMX
-  BFD_RELOC_IA64_SEGBASE
 ENUMX
   BFD_RELOC_IA64_SEGREL32MSB
 ENUMX
@@ -2859,10 +2971,6 @@ ENUMX
   BFD_RELOC_IA64_IPLTMSB
 ENUMX
   BFD_RELOC_IA64_IPLTLSB
-ENUMX
-  BFD_RELOC_IA64_EPLTMSB
-ENUMX
-  BFD_RELOC_IA64_EPLTLSB
 ENUMX
   BFD_RELOC_IA64_COPY
 ENUMX
@@ -2879,6 +2987,149 @@ ENUMX
   BFD_RELOC_IA64_LDXMOV
 ENUMDOC
   Intel IA64 Relocations.
+
+ENUM
+  BFD_RELOC_M68HC11_HI8
+ENUMDOC
+  Motorola 68HC11 reloc.
+  This is the 8 bits high part of an absolute address.
+ENUM
+  BFD_RELOC_M68HC11_LO8
+ENUMDOC
+  Motorola 68HC11 reloc.
+  This is the 8 bits low part of an absolute address.
+ENUM
+  BFD_RELOC_M68HC11_3B
+ENUMDOC
+  Motorola 68HC11 reloc.
+  This is the 3 bits of a value.
+
+ENUM
+  BFD_RELOC_CRIS_BDISP8
+ENUMX
+  BFD_RELOC_CRIS_UNSIGNED_5
+ENUMX
+  BFD_RELOC_CRIS_SIGNED_6
+ENUMX
+  BFD_RELOC_CRIS_UNSIGNED_6
+ENUMX
+  BFD_RELOC_CRIS_UNSIGNED_4
+ENUMDOC
+  These relocs are only used within the CRIS assembler.  They are not
+  (at present) written to any object files.
+ENUM
+  BFD_RELOC_CRIS_COPY
+ENUMX
+  BFD_RELOC_CRIS_GLOB_DAT
+ENUMX
+  BFD_RELOC_CRIS_JUMP_SLOT
+ENUMX
+  BFD_RELOC_CRIS_RELATIVE
+ENUMDOC
+  Relocs used in ELF shared libraries for CRIS.
+ENUM
+  BFD_RELOC_CRIS_32_GOT
+ENUMDOC
+  32-bit offset to symbol-entry within GOT.
+ENUM
+  BFD_RELOC_CRIS_16_GOT
+ENUMDOC
+  16-bit offset to symbol-entry within GOT.
+ENUM
+  BFD_RELOC_CRIS_32_GOTPLT
+ENUMDOC
+  32-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+  BFD_RELOC_CRIS_16_GOTPLT
+ENUMDOC
+  16-bit offset to symbol-entry within GOT, with PLT handling.
+ENUM
+  BFD_RELOC_CRIS_32_GOTREL
+ENUMDOC
+  32-bit offset to symbol, relative to GOT.
+ENUM
+  BFD_RELOC_CRIS_32_PLT_GOTREL
+ENUMDOC
+  32-bit offset to symbol with PLT entry, relative to GOT.
+ENUM
+  BFD_RELOC_CRIS_32_PLT_PCREL
+ENUMDOC
+  32-bit offset to symbol with PLT entry, relative to this relocation.
+
+ENUM
+  BFD_RELOC_860_COPY
+ENUMX
+  BFD_RELOC_860_GLOB_DAT
+ENUMX
+  BFD_RELOC_860_JUMP_SLOT
+ENUMX
+  BFD_RELOC_860_RELATIVE
+ENUMX
+  BFD_RELOC_860_PC26
+ENUMX
+  BFD_RELOC_860_PLT26
+ENUMX
+  BFD_RELOC_860_PC16
+ENUMX
+  BFD_RELOC_860_LOW0
+ENUMX
+  BFD_RELOC_860_SPLIT0
+ENUMX
+  BFD_RELOC_860_LOW1
+ENUMX
+  BFD_RELOC_860_SPLIT1
+ENUMX
+  BFD_RELOC_860_LOW2
+ENUMX
+  BFD_RELOC_860_SPLIT2
+ENUMX
+  BFD_RELOC_860_LOW3
+ENUMX
+  BFD_RELOC_860_LOGOT0
+ENUMX
+  BFD_RELOC_860_SPGOT0
+ENUMX
+  BFD_RELOC_860_LOGOT1
+ENUMX
+  BFD_RELOC_860_SPGOT1
+ENUMX
+  BFD_RELOC_860_LOGOTOFF0
+ENUMX
+  BFD_RELOC_860_SPGOTOFF0
+ENUMX
+  BFD_RELOC_860_LOGOTOFF1
+ENUMX
+  BFD_RELOC_860_SPGOTOFF1
+ENUMX
+  BFD_RELOC_860_LOGOTOFF2
+ENUMX
+  BFD_RELOC_860_LOGOTOFF3
+ENUMX
+  BFD_RELOC_860_LOPC
+ENUMX
+  BFD_RELOC_860_HIGHADJ
+ENUMX
+  BFD_RELOC_860_HAGOT
+ENUMX
+  BFD_RELOC_860_HAGOTOFF
+ENUMX
+  BFD_RELOC_860_HAPC
+ENUMX
+  BFD_RELOC_860_HIGH
+ENUMX
+  BFD_RELOC_860_HIGOT
+ENUMX
+  BFD_RELOC_860_HIGOTOFF
+ENUMDOC
+  Intel i860 Relocations.
+
+ENUM
+  BFD_RELOC_OPENRISC_ABS_26
+ENUMX
+  BFD_RELOC_OPENRISC_REL_26
+ENUMDOC
+  OpenRISC Relocations.
+
 ENDSENUM
   BFD_RELOC_UNUSED
 CODE_FRAGMENT
@@ -2886,7 +3137,6 @@ CODE_FRAGMENT
 .typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
 */
 
-
 /*
 FUNCTION
        bfd_reloc_type_lookup
@@ -2902,7 +3152,6 @@ DESCRIPTION
 
 */
 
-
 reloc_howto_type *
 bfd_reloc_type_lookup (abfd, code)
      bfd *abfd;
@@ -2914,7 +3163,6 @@ bfd_reloc_type_lookup (abfd, code)
 static reloc_howto_type bfd_howto_32 =
 HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true);
 
-
 /*
 INTERNAL_FUNCTION
        bfd_default_reloc_type_lookup
@@ -2926,7 +3174,6 @@ SYNOPSIS
 DESCRIPTION
        Provides a default relocation lookup routine for any architecture.
 
-
 */
 
 reloc_howto_type *
@@ -3027,6 +3274,28 @@ bfd_generic_gc_sections (abfd, link_info)
   return true;
 }
 
+/*
+INTERNAL_FUNCTION
+       bfd_generic_merge_sections
+
+SYNOPSIS
+       boolean bfd_generic_merge_sections
+        (bfd *, struct bfd_link_info *);
+
+DESCRIPTION
+       Provides default handling for SEC_MERGE section merging for back ends
+       which don't have SEC_MERGE support -- i.e., does nothing.
+*/
+
+/*ARGSUSED*/
+boolean
+bfd_generic_merge_sections (abfd, link_info)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+{
+  return true;
+}
+
 /*
 INTERNAL_FUNCTION
        bfd_generic_get_relocated_section_contents
This page took 0.03255 seconds and 4 git commands to generate.