| 1 | /* Intel i860 specific support for 32-bit ELF.
|
|---|
| 2 | Copyright 1993, 1995, 1999, 2000, 2001, 2002
|
|---|
| 3 | Free Software Foundation, Inc.
|
|---|
| 4 |
|
|---|
| 5 | Full i860 support contributed by Jason Eckhardt <[email protected]>.
|
|---|
| 6 |
|
|---|
| 7 | This file is part of BFD, the Binary File Descriptor library.
|
|---|
| 8 |
|
|---|
| 9 | This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | it under the terms of the GNU General Public License as published by
|
|---|
| 11 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 12 | (at your option) any later version.
|
|---|
| 13 |
|
|---|
| 14 | This program is distributed in the hope that it will be useful,
|
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | GNU General Public License for more details.
|
|---|
| 18 |
|
|---|
| 19 | You should have received a copy of the GNU General Public License
|
|---|
| 20 | along with this program; if not, write to the Free Software
|
|---|
| 21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|---|
| 22 |
|
|---|
| 23 | #include "bfd.h"
|
|---|
| 24 | #include "sysdep.h"
|
|---|
| 25 | #include "libbfd.h"
|
|---|
| 26 | #include "elf-bfd.h"
|
|---|
| 27 | #include "elf/i860.h"
|
|---|
| 28 |
|
|---|
| 29 | /* Prototypes. */
|
|---|
| 30 | static reloc_howto_type *lookup_howto
|
|---|
| 31 | PARAMS ((unsigned int));
|
|---|
| 32 |
|
|---|
| 33 | static reloc_howto_type *elf32_i860_reloc_type_lookup
|
|---|
| 34 | PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
|---|
| 35 |
|
|---|
| 36 | static void elf32_i860_info_to_howto_rela
|
|---|
| 37 | PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
|---|
| 38 |
|
|---|
| 39 | static bfd_reloc_status_type elf32_i860_relocate_splitn
|
|---|
| 40 | PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
|
|---|
| 41 |
|
|---|
| 42 | static bfd_reloc_status_type elf32_i860_relocate_pc16
|
|---|
| 43 | PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
|
|---|
| 44 |
|
|---|
| 45 | static bfd_reloc_status_type elf32_i860_relocate_pc26
|
|---|
| 46 | PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
|
|---|
| 47 |
|
|---|
| 48 | static bfd_reloc_status_type elf32_i860_relocate_highadj
|
|---|
| 49 | PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
|
|---|
| 50 |
|
|---|
| 51 | static bfd_boolean elf32_i860_relocate_section
|
|---|
| 52 | PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
|---|
| 53 | Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
|
|---|
| 54 |
|
|---|
| 55 | static bfd_reloc_status_type i860_final_link_relocate
|
|---|
| 56 | PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *,
|
|---|
| 57 | Elf_Internal_Rela *, bfd_vma));
|
|---|
| 58 |
|
|---|
| 59 | static bfd_boolean elf32_i860_is_local_label_name
|
|---|
| 60 | PARAMS ((bfd *, const char *));
|
|---|
| 61 |
|
|---|
| 62 | /* This howto table is preliminary. */
|
|---|
| 63 | static reloc_howto_type elf32_i860_howto_table [] =
|
|---|
| 64 | {
|
|---|
| 65 | /* This relocation does nothing. */
|
|---|
| 66 | HOWTO (R_860_NONE, /* type */
|
|---|
| 67 | 0, /* rightshift */
|
|---|
| 68 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 69 | 32, /* bitsize */
|
|---|
| 70 | FALSE, /* pc_relative */
|
|---|
| 71 | 0, /* bitpos */
|
|---|
| 72 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 73 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 74 | "R_860_NONE", /* name */
|
|---|
| 75 | FALSE, /* partial_inplace */
|
|---|
| 76 | 0, /* src_mask */
|
|---|
| 77 | 0, /* dst_mask */
|
|---|
| 78 | FALSE), /* pcrel_offset */
|
|---|
| 79 |
|
|---|
| 80 | /* A 32-bit absolute relocation. */
|
|---|
| 81 | HOWTO (R_860_32, /* type */
|
|---|
| 82 | 0, /* rightshift */
|
|---|
| 83 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 84 | 32, /* bitsize */
|
|---|
| 85 | FALSE, /* pc_relative */
|
|---|
| 86 | 0, /* bitpos */
|
|---|
| 87 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 88 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 89 | "R_860_32", /* name */
|
|---|
| 90 | FALSE, /* partial_inplace */
|
|---|
| 91 | 0xffffffff, /* src_mask */
|
|---|
| 92 | 0xffffffff, /* dst_mask */
|
|---|
| 93 | FALSE), /* pcrel_offset */
|
|---|
| 94 |
|
|---|
| 95 | HOWTO (R_860_COPY, /* type */
|
|---|
| 96 | 0, /* rightshift */
|
|---|
| 97 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 98 | 32, /* bitsize */
|
|---|
| 99 | FALSE, /* pc_relative */
|
|---|
| 100 | 0, /* bitpos */
|
|---|
| 101 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 102 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 103 | "R_860_COPY", /* name */
|
|---|
| 104 | TRUE, /* partial_inplace */
|
|---|
| 105 | 0xffffffff, /* src_mask */
|
|---|
| 106 | 0xffffffff, /* dst_mask */
|
|---|
| 107 | FALSE), /* pcrel_offset */
|
|---|
| 108 |
|
|---|
| 109 | HOWTO (R_860_GLOB_DAT, /* type */
|
|---|
| 110 | 0, /* rightshift */
|
|---|
| 111 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 112 | 32, /* bitsize */
|
|---|
| 113 | FALSE, /* pc_relative */
|
|---|
| 114 | 0, /* bitpos */
|
|---|
| 115 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 116 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 117 | "R_860_GLOB_DAT", /* name */
|
|---|
| 118 | TRUE, /* partial_inplace */
|
|---|
| 119 | 0xffffffff, /* src_mask */
|
|---|
| 120 | 0xffffffff, /* dst_mask */
|
|---|
| 121 | FALSE), /* pcrel_offset */
|
|---|
| 122 |
|
|---|
| 123 | HOWTO (R_860_JUMP_SLOT, /* type */
|
|---|
| 124 | 0, /* rightshift */
|
|---|
| 125 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 126 | 32, /* bitsize */
|
|---|
| 127 | FALSE, /* pc_relative */
|
|---|
| 128 | 0, /* bitpos */
|
|---|
| 129 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 130 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 131 | "R_860_JUMP_SLOT", /* name */
|
|---|
| 132 | TRUE, /* partial_inplace */
|
|---|
| 133 | 0xffffffff, /* src_mask */
|
|---|
| 134 | 0xffffffff, /* dst_mask */
|
|---|
| 135 | FALSE), /* pcrel_offset */
|
|---|
| 136 |
|
|---|
| 137 | HOWTO (R_860_RELATIVE, /* type */
|
|---|
| 138 | 0, /* rightshift */
|
|---|
| 139 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 140 | 32, /* bitsize */
|
|---|
| 141 | FALSE, /* pc_relative */
|
|---|
| 142 | 0, /* bitpos */
|
|---|
| 143 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 144 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 145 | "R_860_RELATIVE", /* name */
|
|---|
| 146 | TRUE, /* partial_inplace */
|
|---|
| 147 | 0xffffffff, /* src_mask */
|
|---|
| 148 | 0xffffffff, /* dst_mask */
|
|---|
| 149 | FALSE), /* pcrel_offset */
|
|---|
| 150 |
|
|---|
| 151 | /* A 26-bit PC-relative relocation. */
|
|---|
| 152 | HOWTO (R_860_PC26, /* type */
|
|---|
| 153 | 2, /* rightshift */
|
|---|
| 154 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 155 | 26, /* bitsize */
|
|---|
| 156 | TRUE, /* pc_relative */
|
|---|
| 157 | 0, /* bitpos */
|
|---|
| 158 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 159 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 160 | "R_860_PC26", /* name */
|
|---|
| 161 | FALSE, /* partial_inplace */
|
|---|
| 162 | 0x3ffffff, /* src_mask */
|
|---|
| 163 | 0x3ffffff, /* dst_mask */
|
|---|
| 164 | TRUE), /* pcrel_offset */
|
|---|
| 165 |
|
|---|
| 166 | HOWTO (R_860_PLT26, /* type */
|
|---|
| 167 | 0, /* rightshift */
|
|---|
| 168 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 169 | 26, /* bitsize */
|
|---|
| 170 | TRUE, /* pc_relative */
|
|---|
| 171 | 0, /* bitpos */
|
|---|
| 172 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 173 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 174 | "R_860_PLT26", /* name */
|
|---|
| 175 | TRUE, /* partial_inplace */
|
|---|
| 176 | 0xffffffff, /* src_mask */
|
|---|
| 177 | 0xffffffff, /* dst_mask */
|
|---|
| 178 | TRUE), /* pcrel_offset */
|
|---|
| 179 |
|
|---|
| 180 | /* A 16-bit PC-relative relocation. */
|
|---|
| 181 | HOWTO (R_860_PC16, /* type */
|
|---|
| 182 | 2, /* rightshift */
|
|---|
| 183 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 184 | 16, /* bitsize */
|
|---|
| 185 | TRUE, /* pc_relative */
|
|---|
| 186 | 0, /* bitpos */
|
|---|
| 187 | complain_overflow_bitfield, /* complain_on_overflow */
|
|---|
| 188 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 189 | "R_860_PC16", /* name */
|
|---|
| 190 | FALSE, /* partial_inplace */
|
|---|
| 191 | 0x1f07ff, /* src_mask */
|
|---|
| 192 | 0x1f07ff, /* dst_mask */
|
|---|
| 193 | TRUE), /* pcrel_offset */
|
|---|
| 194 |
|
|---|
| 195 | HOWTO (R_860_LOW0, /* type */
|
|---|
| 196 | 0, /* rightshift */
|
|---|
| 197 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 198 | 16, /* bitsize */
|
|---|
| 199 | FALSE, /* pc_relative */
|
|---|
| 200 | 0, /* bitpos */
|
|---|
| 201 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 202 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 203 | "R_860_LOW0", /* name */
|
|---|
| 204 | FALSE, /* partial_inplace */
|
|---|
| 205 | 0xffff, /* src_mask */
|
|---|
| 206 | 0xffff, /* dst_mask */
|
|---|
| 207 | FALSE), /* pcrel_offset */
|
|---|
| 208 |
|
|---|
| 209 | HOWTO (R_860_SPLIT0, /* type */
|
|---|
| 210 | 0, /* rightshift */
|
|---|
| 211 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 212 | 16, /* bitsize */
|
|---|
| 213 | FALSE, /* pc_relative */
|
|---|
| 214 | 0, /* bitpos */
|
|---|
| 215 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 216 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 217 | "R_860_SPLIT0", /* name */
|
|---|
| 218 | FALSE, /* partial_inplace */
|
|---|
| 219 | 0x1f07ff, /* src_mask */
|
|---|
| 220 | 0x1f07ff, /* dst_mask */
|
|---|
| 221 | FALSE), /* pcrel_offset */
|
|---|
| 222 |
|
|---|
| 223 | HOWTO (R_860_LOW1, /* type */
|
|---|
| 224 | 0, /* rightshift */
|
|---|
| 225 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 226 | 16, /* bitsize */
|
|---|
| 227 | FALSE, /* pc_relative */
|
|---|
| 228 | 0, /* bitpos */
|
|---|
| 229 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 230 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 231 | "R_860_LOW1", /* name */
|
|---|
| 232 | FALSE, /* partial_inplace */
|
|---|
| 233 | 0xfffe, /* src_mask */
|
|---|
| 234 | 0xfffe, /* dst_mask */
|
|---|
| 235 | FALSE), /* pcrel_offset */
|
|---|
| 236 |
|
|---|
| 237 | HOWTO (R_860_SPLIT1, /* type */
|
|---|
| 238 | 0, /* rightshift */
|
|---|
| 239 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 240 | 16, /* bitsize */
|
|---|
| 241 | FALSE, /* pc_relative */
|
|---|
| 242 | 0, /* bitpos */
|
|---|
| 243 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 244 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 245 | "R_860_SPLIT1", /* name */
|
|---|
| 246 | FALSE, /* partial_inplace */
|
|---|
| 247 | 0x1f07fe, /* src_mask */
|
|---|
| 248 | 0x1f07fe, /* dst_mask */
|
|---|
| 249 | FALSE), /* pcrel_offset */
|
|---|
| 250 |
|
|---|
| 251 | HOWTO (R_860_LOW2, /* type */
|
|---|
| 252 | 0, /* rightshift */
|
|---|
| 253 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 254 | 16, /* bitsize */
|
|---|
| 255 | FALSE, /* pc_relative */
|
|---|
| 256 | 0, /* bitpos */
|
|---|
| 257 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 258 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 259 | "R_860_LOW2", /* name */
|
|---|
| 260 | FALSE, /* partial_inplace */
|
|---|
| 261 | 0xfffc, /* src_mask */
|
|---|
| 262 | 0xfffc, /* dst_mask */
|
|---|
| 263 | FALSE), /* pcrel_offset */
|
|---|
| 264 |
|
|---|
| 265 | HOWTO (R_860_SPLIT2, /* type */
|
|---|
| 266 | 0, /* rightshift */
|
|---|
| 267 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 268 | 16, /* bitsize */
|
|---|
| 269 | FALSE, /* pc_relative */
|
|---|
| 270 | 0, /* bitpos */
|
|---|
| 271 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 272 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 273 | "R_860_SPLIT2", /* name */
|
|---|
| 274 | FALSE, /* partial_inplace */
|
|---|
| 275 | 0x1f07fc, /* src_mask */
|
|---|
| 276 | 0x1f07fc, /* dst_mask */
|
|---|
| 277 | FALSE), /* pcrel_offset */
|
|---|
| 278 |
|
|---|
| 279 | HOWTO (R_860_LOW3, /* type */
|
|---|
| 280 | 0, /* rightshift */
|
|---|
| 281 | 2, /* size (0 = byte, 1 = short, 2 = long) */
|
|---|
| 282 | 16, /* bitsize */
|
|---|
| 283 | FALSE, /* pc_relative */
|
|---|
| 284 | 0, /* bitpos */
|
|---|
| 285 | complain_overflow_dont, /* complain_on_overflow */
|
|---|
| 286 | bfd_elf_generic_reloc, /* special_function */
|
|---|
| 287 | "R_860_LOW3", /* name */
|
|---|
| 288 | FALSE, /* partial_inplace */
|
|---|
| 289 | 0xfff8, /* src_mask */
|
|---|
| 290 | 0xfff8, /* dst_mask */
|
|---|
| 291 | FALSE), /* pcrel_offset */
|
|---|
| 292 |
|
|---|
|
|---|