| 1 | /* SPARC ELF support for BFD. |
| 2 | Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. |
| 3 | By Doug Evans, Cygnus Support, <dje@cygnus.com>. |
| 4 | |
| 5 | This file is part of BFD, the Binary File Descriptor library. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | #ifndef _ELF_SPARC_H |
| 22 | #define _ELF_SPARC_H |
| 23 | |
| 24 | /* Processor specific flags for the ELF header e_flags field. */ |
| 25 | |
| 26 | /* These are defined by Sun. */ |
| 27 | |
| 28 | #define EF_SPARC_32PLUS_MASK 0xffff00 /* bits indicating V8+ type */ |
| 29 | #define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ |
| 30 | #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ |
| 31 | #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ |
| 32 | |
| 33 | #define EF_SPARC_LEDATA 0x800000 /* little endian data */ |
| 34 | |
| 35 | /* This name is used in the V9 ABI. */ |
| 36 | #define EF_SPARC_EXT_MASK 0xffff00 /* reserved for vendor extensions */ |
| 37 | |
| 38 | /* V9 memory models */ |
| 39 | #define EF_SPARCV9_MM 0x3 /* memory model mask */ |
| 40 | #define EF_SPARCV9_TSO 0x0 /* total store ordering */ |
| 41 | #define EF_SPARCV9_PSO 0x1 /* partial store ordering */ |
| 42 | #define EF_SPARCV9_RMO 0x2 /* relaxed store ordering */ |
| 43 | |
| 44 | /* Section indices. */ |
| 45 | |
| 46 | #define SHN_BEFORE 0xff00 /* used with SHF_ORDERED */ |
| 47 | #define SHN_AFTER 0xff01 /* used with SHF_ORDERED */ |
| 48 | |
| 49 | /* Section flags. */ |
| 50 | |
| 51 | #define SHF_EXCLUDE 0x80000000 /* exclude from linking */ |
| 52 | #define SHF_ORDERED 0x40000000 /* treat sh_link,sh_info specially */ |
| 53 | |
| 54 | /* Symbol types. */ |
| 55 | |
| 56 | #define STT_REGISTER 13 /* global reg reserved to app. */ |
| 57 | |
| 58 | #include "elf/reloc-macros.h" |
| 59 | |
| 60 | /* Relocation types. */ |
| 61 | START_RELOC_NUMBERS (elf_sparc_reloc_type) |
| 62 | RELOC_NUMBER (R_SPARC_NONE, 0) |
| 63 | RELOC_NUMBER (R_SPARC_8, 1) |
| 64 | RELOC_NUMBER (R_SPARC_16, 2) |
| 65 | RELOC_NUMBER (R_SPARC_32, 3) |
| 66 | RELOC_NUMBER (R_SPARC_DISP8, 4) |
| 67 | RELOC_NUMBER (R_SPARC_DISP16, 5) |
| 68 | RELOC_NUMBER (R_SPARC_DISP32, 6) |
| 69 | RELOC_NUMBER (R_SPARC_WDISP30, 7) |
| 70 | RELOC_NUMBER (R_SPARC_WDISP22, 8) |
| 71 | RELOC_NUMBER (R_SPARC_HI22, 9) |
| 72 | RELOC_NUMBER (R_SPARC_22, 10) |
| 73 | RELOC_NUMBER (R_SPARC_13, 11) |
| 74 | RELOC_NUMBER (R_SPARC_LO10, 12) |
| 75 | RELOC_NUMBER (R_SPARC_GOT10, 13) |
| 76 | RELOC_NUMBER (R_SPARC_GOT13, 14) |
| 77 | RELOC_NUMBER (R_SPARC_GOT22, 15) |
| 78 | RELOC_NUMBER (R_SPARC_PC10, 16) |
| 79 | RELOC_NUMBER (R_SPARC_PC22, 17) |
| 80 | RELOC_NUMBER (R_SPARC_WPLT30, 18) |
| 81 | RELOC_NUMBER (R_SPARC_COPY, 19) |
| 82 | RELOC_NUMBER (R_SPARC_GLOB_DAT, 20) |
| 83 | RELOC_NUMBER (R_SPARC_JMP_SLOT, 21) |
| 84 | RELOC_NUMBER (R_SPARC_RELATIVE, 22) |
| 85 | RELOC_NUMBER (R_SPARC_UA32, 23) |
| 86 | |
| 87 | /* ??? These 6 relocs are new but not currently used. For binary |
| 88 | compatility in the sparc64-elf toolchain, we leave them out. |
| 89 | A non-binary upward compatible change is expected for sparc64-elf. */ |
| 90 | #ifndef SPARC64_OLD_RELOCS |
| 91 | /* ??? New relocs on the UltraSPARC. Not sure what they're for yet. */ |
| 92 | RELOC_NUMBER (R_SPARC_PLT32, 24) |
| 93 | RELOC_NUMBER (R_SPARC_HIPLT22, 25) |
| 94 | RELOC_NUMBER (R_SPARC_LOPLT10, 26) |
| 95 | RELOC_NUMBER (R_SPARC_PCPLT32, 27) |
| 96 | RELOC_NUMBER (R_SPARC_PCPLT22, 28) |
| 97 | RELOC_NUMBER (R_SPARC_PCPLT10, 29) |
| 98 | #endif |
| 99 | |
| 100 | /* v9 relocs */ |
| 101 | RELOC_NUMBER (R_SPARC_10, 30) |
| 102 | RELOC_NUMBER (R_SPARC_11, 31) |
| 103 | RELOC_NUMBER (R_SPARC_64, 32) |
| 104 | RELOC_NUMBER (R_SPARC_OLO10, 33) |
| 105 | RELOC_NUMBER (R_SPARC_HH22, 34) |
| 106 | RELOC_NUMBER (R_SPARC_HM10, 35) |
| 107 | RELOC_NUMBER (R_SPARC_LM22, 36) |
| 108 | RELOC_NUMBER (R_SPARC_PC_HH22, 37) |
| 109 | RELOC_NUMBER (R_SPARC_PC_HM10, 38) |
| 110 | RELOC_NUMBER (R_SPARC_PC_LM22, 39) |
| 111 | RELOC_NUMBER (R_SPARC_WDISP16, 40) |
| 112 | RELOC_NUMBER (R_SPARC_WDISP19, 41) |
| 113 | RELOC_NUMBER (R_SPARC_UNUSED_42, 42) |
| 114 | RELOC_NUMBER (R_SPARC_7, 43) |
| 115 | RELOC_NUMBER (R_SPARC_5, 44) |
| 116 | RELOC_NUMBER (R_SPARC_6, 45) |
| 117 | RELOC_NUMBER (R_SPARC_DISP64, 46) |
| 118 | RELOC_NUMBER (R_SPARC_PLT64, 47) |
| 119 | RELOC_NUMBER (R_SPARC_HIX22, 48) |
| 120 | RELOC_NUMBER (R_SPARC_LOX10, 49) |
| 121 | RELOC_NUMBER (R_SPARC_H44, 50) |
| 122 | RELOC_NUMBER (R_SPARC_M44, 51) |
| 123 | RELOC_NUMBER (R_SPARC_L44, 52) |
| 124 | RELOC_NUMBER (R_SPARC_REGISTER, 53) |
| 125 | RELOC_NUMBER (R_SPARC_UA64, 54) |
| 126 | RELOC_NUMBER (R_SPARC_UA16, 55) |
| 127 | |
| 128 | /* little endian data relocs */ |
| 129 | RELOC_NUMBER (R_SPARC_REV32, 56) |
| 130 | |
| 131 | RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250) |
| 132 | RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251) |
| 133 | |
| 134 | EMPTY_RELOC (R_SPARC_max) |
| 135 | END_RELOC_NUMBERS |
| 136 | |
| 137 | /* Relocation macros. */ |
| 138 | |
| 139 | #define ELF64_R_TYPE_DATA(info) (((bfd_vma) (info) << 32) >> 40) |
| 140 | #define ELF64_R_TYPE_ID(info) (((bfd_vma) (info) << 56) >> 56) |
| 141 | #define ELF64_R_TYPE_INFO(data, type) (((bfd_vma) (data) << 8) \ |
| 142 | + (bfd_vma) (type)) |
| 143 | |
| 144 | #define DT_SPARC_REGISTER 0x70000001 |
| 145 | |
| 146 | /* |
| 147 | * FIXME: NOT ABI -- GET RID OF THIS |
| 148 | * Defines the format used by the .plt. Currently defined values are |
| 149 | * 0 -- reserved to SI |
| 150 | * 1 -- absolute address in .got.plt |
| 151 | * 2 -- got-relative address in .got.plt |
| 152 | */ |
| 153 | |
| 154 | #define DT_SPARC_PLTFMT 0x70000001 |
| 155 | |
| 156 | #endif /* _ELF_SPARC_H */ |