2000-07-19 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / include / elf / sparc.h
index 1b5300183a6960efe99dc7c2e255119af5a142c8..f4a199e8994c900507ebc97a1aab192db05cd65b 100644 (file)
@@ -1,5 +1,5 @@
 /* SPARC ELF support for BFD.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 97, 98, 99, 2000 Free Software Foundation, Inc.
    By Doug Evans, Cygnus Support, <dje@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -29,6 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define EF_SPARC_32PLUS                0x000100        /* generic V8+ features */
 #define EF_SPARC_SUN_US1       0x000200        /* Sun UltraSPARC1 extensions */
 #define EF_SPARC_HAL_R1                0x000400        /* HAL R1 extensions */
+#define EF_SPARC_SUN_US3       0x000800        /* Sun UltraSPARCIII extensions */
+
+#define EF_SPARC_LEDATA         0x800000       /* little endian data */
 
 /* This name is used in the V9 ABI.  */
 #define EF_SPARC_EXT_MASK      0xffff00        /* reserved for vendor extensions */
@@ -53,64 +56,97 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #define STT_REGISTER           13              /* global reg reserved to app. */
 
-/* Relocation types.  */
+#include "elf/reloc-macros.h"
 
-enum elf_sparc_reloc_type {
-    R_SPARC_NONE = 0,
-    R_SPARC_8, R_SPARC_16, R_SPARC_32,
-    R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
-    R_SPARC_WDISP30, R_SPARC_WDISP22,
-    R_SPARC_HI22, R_SPARC_22,
-    R_SPARC_13, R_SPARC_LO10,
-    R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
-    R_SPARC_PC10, R_SPARC_PC22,
-    R_SPARC_WPLT30,
-    R_SPARC_COPY,
-    R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
-    R_SPARC_RELATIVE,
-    R_SPARC_UA32,
-
-    /* ??? These 6 relocs are new but not currently used.  For binary
-       compatility in the sparc64-elf toolchain, we leave them out.
-       A non-binary upward compatible change is expected for sparc64-elf.  */
+/* Relocation types.  */
+START_RELOC_NUMBERS (elf_sparc_reloc_type)
+  RELOC_NUMBER (R_SPARC_NONE, 0)
+  RELOC_NUMBER (R_SPARC_8, 1)
+  RELOC_NUMBER (R_SPARC_16, 2)
+  RELOC_NUMBER (R_SPARC_32, 3)
+  RELOC_NUMBER (R_SPARC_DISP8, 4)
+  RELOC_NUMBER (R_SPARC_DISP16, 5)
+  RELOC_NUMBER (R_SPARC_DISP32, 6)
+  RELOC_NUMBER (R_SPARC_WDISP30, 7)
+  RELOC_NUMBER (R_SPARC_WDISP22, 8)
+  RELOC_NUMBER (R_SPARC_HI22, 9)
+  RELOC_NUMBER (R_SPARC_22, 10)
+  RELOC_NUMBER (R_SPARC_13, 11)
+  RELOC_NUMBER (R_SPARC_LO10, 12)
+  RELOC_NUMBER (R_SPARC_GOT10, 13)
+  RELOC_NUMBER (R_SPARC_GOT13, 14)
+  RELOC_NUMBER (R_SPARC_GOT22, 15)
+  RELOC_NUMBER (R_SPARC_PC10, 16)
+  RELOC_NUMBER (R_SPARC_PC22, 17)
+  RELOC_NUMBER (R_SPARC_WPLT30, 18)
+  RELOC_NUMBER (R_SPARC_COPY, 19)
+  RELOC_NUMBER (R_SPARC_GLOB_DAT, 20)
+  RELOC_NUMBER (R_SPARC_JMP_SLOT, 21)
+  RELOC_NUMBER (R_SPARC_RELATIVE, 22)
+  RELOC_NUMBER (R_SPARC_UA32, 23)
+
+  /* ??? These 6 relocs are new but not currently used.  For binary
+     compatility in the sparc64-elf toolchain, we leave them out.
+     A non-binary upward compatible change is expected for sparc64-elf.  */
 #ifndef SPARC64_OLD_RELOCS
-    /* ??? New relocs on the UltraSPARC.  Not sure what they're for yet.  */
-    R_SPARC_PLT32, R_SPARC_HIPLT22, R_SPARC_LOPLT10,
-    R_SPARC_PCPLT32, R_SPARC_PCPLT22, R_SPARC_PCPLT10,
+  /* ??? New relocs on the UltraSPARC.  Not sure what they're for yet.  */
+  RELOC_NUMBER (R_SPARC_PLT32, 24)
+  RELOC_NUMBER (R_SPARC_HIPLT22, 25)
+  RELOC_NUMBER (R_SPARC_LOPLT10, 26)
+  RELOC_NUMBER (R_SPARC_PCPLT32, 27)
+  RELOC_NUMBER (R_SPARC_PCPLT22, 28)
+  RELOC_NUMBER (R_SPARC_PCPLT10, 29)
 #endif
 
-    /* v9 relocs */
-    R_SPARC_10, R_SPARC_11, R_SPARC_64,
-    R_SPARC_OLO10, R_SPARC_HH22, R_SPARC_HM10, R_SPARC_LM22,
-    R_SPARC_PC_HH22, R_SPARC_PC_HM10, R_SPARC_PC_LM22,
-    R_SPARC_WDISP16, R_SPARC_WDISP19,
-    R_SPARC_UNUSED_42,
-    R_SPARC_7, R_SPARC_5, R_SPARC_6,
-    R_SPARC_DISP64, R_SPARC_PLT64,
-    R_SPARC_HIX22, R_SPARC_LOX10,
-    R_SPARC_H44, R_SPARC_M44, R_SPARC_L44,
-    R_SPARC_REGISTER,
-
-    R_SPARC_max
-};
+  /* v9 relocs */
+  RELOC_NUMBER (R_SPARC_10, 30)
+  RELOC_NUMBER (R_SPARC_11, 31)
+  RELOC_NUMBER (R_SPARC_64, 32)
+  RELOC_NUMBER (R_SPARC_OLO10, 33)
+  RELOC_NUMBER (R_SPARC_HH22, 34)
+  RELOC_NUMBER (R_SPARC_HM10, 35)
+  RELOC_NUMBER (R_SPARC_LM22, 36)
+  RELOC_NUMBER (R_SPARC_PC_HH22, 37)
+  RELOC_NUMBER (R_SPARC_PC_HM10, 38)
+  RELOC_NUMBER (R_SPARC_PC_LM22, 39)
+  RELOC_NUMBER (R_SPARC_WDISP16, 40)
+  RELOC_NUMBER (R_SPARC_WDISP19, 41)
+  RELOC_NUMBER (R_SPARC_UNUSED_42, 42)
+  RELOC_NUMBER (R_SPARC_7, 43)
+  RELOC_NUMBER (R_SPARC_5, 44)
+  RELOC_NUMBER (R_SPARC_6, 45)
+  RELOC_NUMBER (R_SPARC_DISP64, 46)
+  RELOC_NUMBER (R_SPARC_PLT64, 47)
+  RELOC_NUMBER (R_SPARC_HIX22, 48)
+  RELOC_NUMBER (R_SPARC_LOX10, 49)
+  RELOC_NUMBER (R_SPARC_H44, 50)
+  RELOC_NUMBER (R_SPARC_M44, 51)
+  RELOC_NUMBER (R_SPARC_L44, 52)
+  RELOC_NUMBER (R_SPARC_REGISTER, 53)
+  RELOC_NUMBER (R_SPARC_UA64, 54)
+  RELOC_NUMBER (R_SPARC_UA16, 55)
+
+  /* little endian data relocs */
+  RELOC_NUMBER (R_SPARC_REV32, 56)
+
+  EMPTY_RELOC  (R_SPARC_max_std)
+
+  RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250)
+  RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251)
+
+END_RELOC_NUMBERS (R_SPARC_max)
 
 /* Relocation macros.  */
 
-#define ELF64_R_TYPE_DATA(info)                (((bfd_vma) (info) << 32) >> 40)
-#define ELF64_R_TYPE_ID(info)          (((bfd_vma) (info) << 56) >> 56)
-#define ELF64_R_TYPE_INFO(data, type)  (((bfd_vma) (data) << 8) \
-                                        + (bfd_vma) (type))
+#define ELF64_R_TYPE_DATA(info) \
+  (((bfd_signed_vma)(ELF64_R_TYPE(info) >> 8) ^ 0x800000) - 0x800000)
+#define ELF64_R_TYPE_ID(info) \
+  ((info) & 0xff)
+#define ELF64_R_TYPE_INFO(data, type) \
+  (((bfd_vma) ((data) & 0xffffff) << 8) | (bfd_vma) (type))
 
-#define DT_SPARC_REGISTER      0x70000001
-
-/*
- * FIXME: NOT ABI -- GET RID OF THIS
- * Defines the format used by the .plt.  Currently defined values are
- *   0 -- reserved to SI
- *   1 -- absolute address in .got.plt
- *   2 -- got-relative address in .got.plt
- */
+/* Values for Elf64_Dyn.d_tag.  */
 
-#define DT_SPARC_PLTFMT                0x70000001
+#define DT_SPARC_REGISTER      0x70000001
 
 #endif /* _ELF_SPARC_H */
This page took 0.024988 seconds and 4 git commands to generate.