1/* ARC relocation types 2 Copyright (C) 2015-2016 Free Software Foundation, Inc. 3 4 This file is part of BFD, the Binary File Descriptor library. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 GAS/GDB is free software; you can redistribute it and/or modify 17 it under the terms of the GNU General Public License as published by 18 the Free Software Foundation; either version 3, or (at your option) 19 any later version. 20 21 GAS/GDB is distributed in the hope that it will be useful, 22 but WITHOUT ANY WARRANTY; without even the implied warranty of 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 GNU General Public License for more details. 25 26 You should have received a copy of the GNU General Public License 27 along with GAS or GDB; see the file COPYING3. If not, write to 28 the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, 29 MA 02110-1301, USA. */ 30 31 32ARC_RELOC_HOWTO(ARC_NONE, 0, \ 33 2, \ 34 32, \ 35 replace_none, \ 36 bitfield, \ 37 0) 38 39ARC_RELOC_HOWTO(ARC_8, 1, \ 40 0, \ 41 8, \ 42 replace_bits8, \ 43 bitfield, \ 44 ( S + A )) 45 46ARC_RELOC_HOWTO(ARC_16, 2, \ 47 1, \ 48 16, \ 49 replace_bits16, \ 50 bitfield, \ 51 ( S + A )) 52 53ARC_RELOC_HOWTO(ARC_24, 3, \ 54 2, \ 55 24, \ 56 replace_bits24, \ 57 bitfield, \ 58 ( S + A )) 59 60ARC_RELOC_HOWTO(ARC_32, 4, \ 61 2, \ 62 32, \ 63 replace_word32, \ 64 bitfield, \ 65 ( S + A )) 66 67ARC_RELOC_HOWTO(ARC_N8, 8, \ 68 0, \ 69 8, \ 70 replace_bits8, \ 71 bitfield, \ 72 ( S - A )) 73 74ARC_RELOC_HOWTO(ARC_N16, 9, \ 75 1, \ 76 16, \ 77 replace_bits16, \ 78 bitfield, \ 79 ( S - A )) 80 81ARC_RELOC_HOWTO(ARC_N24, 10, \ 82 2, \ 83 24, \ 84 replace_bits24, \ 85 bitfield, \ 86 ( S - A )) 87 88ARC_RELOC_HOWTO(ARC_N32, 11, \ 89 2, \ 90 32, \ 91 replace_word32, \ 92 bitfield, \ 93 ( S - A )) 94 95ARC_RELOC_HOWTO(ARC_SDA, 12, \ 96 2, \ 97 9, \ 98 replace_disp9, \ 99 bitfield, \ 100 ( S + A )) 101 102ARC_RELOC_HOWTO(ARC_SECTOFF, 13, \ 103 2, \ 104 32, \ 105 replace_word32, \ 106 bitfield, \ 107 ( ( S - SECTSTART ) + A )) 108 109ARC_RELOC_HOWTO(ARC_S21H_PCREL, 14, \ 110 2, \ 111 20, \ 112 replace_disp21h, \ 113 signed, \ 114 ( ME ( ( ( ( S + A ) - P ) >> 1 ) ) )) 115 116ARC_RELOC_HOWTO(ARC_S21W_PCREL, 15, \ 117 2, \ 118 19, \ 119 replace_disp21w, \ 120 signed, \ 121 ( ME ( ( ( ( S + A ) - P ) >> 2 ) ) )) 122 123ARC_RELOC_HOWTO(ARC_S25H_PCREL, 16, \ 124 2, \ 125 24, \ 126 replace_disp25h, \ 127 signed, \ 128 ( ME ( ( ( ( S + A ) - P ) >> 1 ) ) )) 129 130ARC_RELOC_HOWTO(ARC_S25W_PCREL, 17, \ 131 2, \ 132 23, \ 133 replace_disp25w, \ 134 signed, \ 135 ( ME ( ( ( ( S + A ) - P ) >> 2 ) ) )) 136 137ARC_RELOC_HOWTO(ARC_SDA32, 18, \ 138 2, \ 139 32, \ 140 replace_word32, \ 141 signed, \ 142 ( ME ( ( ( S + A ) - _SDA_BASE_ ) ) )) 143 144ARC_RELOC_HOWTO(ARC_SDA_LDST, 19, \ 145 2, \ 146 9, \ 147 replace_disp9ls, \ 148 signed, \ 149 ( ME ( ( ( S + A ) - _SDA_BASE_ ) ) )) 150 151ARC_RELOC_HOWTO(ARC_SDA_LDST1, 20, \ 152 2, \ 153 9, \ 154 replace_disp9ls, \ 155 signed, \ 156 ( ME ( ( ( ( S + A ) - _SDA_BASE_ ) >> 1 ) ) )) 157 158ARC_RELOC_HOWTO(ARC_SDA_LDST2, 21, \ 159 2, \ 160 9, \ 161 replace_disp9ls, \ 162 signed, \ 163 ( ME ( ( ( ( S + A ) - _SDA_BASE_ ) >> 2 ) ) )) 164 165ARC_RELOC_HOWTO(ARC_SDA16_LD, 22, \ 166 1, \ 167 9, \ 168 replace_disp9s, \ 169 signed, \ 170 ( ( ( S + A ) - _SDA_BASE_ ) )) 171 172ARC_RELOC_HOWTO(ARC_SDA16_LD1, 23, \ 173 1, \ 174 9, \ 175 replace_disp9s, \ 176 signed, \ 177 ( ( ( ( S + A ) - _SDA_BASE_ ) >> 1 ) )) 178 179ARC_RELOC_HOWTO(ARC_SDA16_LD2, 24, \ 180 1, \ 181 9, \ 182 replace_disp9s, \ 183 signed, \ 184 ( ( ( ( S + A ) - _SDA_BASE_ ) >> 2 ) )) 185 186ARC_RELOC_HOWTO(ARC_S13_PCREL, 25, \ 187 1, \ 188 11, \ 189 replace_disp13s, \ 190 signed, \ 191 ( ( ( ( S + A ) - P ) >> 2 ) )) 192 193ARC_RELOC_HOWTO(ARC_W, 26, \ 194 2, \ 195 32, \ 196 replace_word32, \ 197 bitfield, \ 198 ( ( S + A ) & ( ~3 ) )) 199 200ARC_RELOC_HOWTO(ARC_32_ME, 27, \ 201 2, \ 202 32, \ 203 replace_limm, \ 204 signed, \ 205 ( ME ( ( S + A ) ) )) 206 207ARC_RELOC_HOWTO(ARC_32_ME_S, 105, \ 208 2, \ 209 32, \ 210 replace_limms, \ 211 signed, \ 212 ( ME ( ( S + A ) ) )) 213 214ARC_RELOC_HOWTO(ARC_N32_ME, 28, \ 215 2, \ 216 32, \ 217 replace_word32, \ 218 bitfield, \ 219 ( ME ( ( S - A ) ) )) 220 221ARC_RELOC_HOWTO(ARC_SECTOFF_ME, 29, \ 222 2, \ 223 32, \ 224 replace_word32, \ 225 bitfield, \ 226 ( ME ( ( ( S - SECTSTART ) + A ) ) )) 227 228ARC_RELOC_HOWTO(ARC_SDA32_ME, 30, \ 229 2, \ 230 32, \ 231 replace_limm, \ 232 signed, \ 233 ( ME ( ( ( S + A ) - _SDA_BASE_ ) ) )) 234 235ARC_RELOC_HOWTO(ARC_W_ME, 31, \ 236 2, \ 237 32, \ 238 replace_word32, \ 239 bitfield, \ 240 ( ME ( ( ( S + A ) & ( ~3 ) ) ) )) 241 242ARC_RELOC_HOWTO(AC_SECTOFF_U8, 35, \ 243 2, \ 244 9, \ 245 replace_disp9ls, \ 246 bitfield, \ 247 ( ( S + A ) - SECTSTART )) 248 249ARC_RELOC_HOWTO(AC_SECTOFF_U8_1, 36, \ 250 2, \ 251 9, \ 252 replace_disp9ls, \ 253 bitfield, \ 254 ( ( ( S + A ) - SECTSTART ) >> 1 )) 255 256ARC_RELOC_HOWTO(AC_SECTOFF_U8_2, 37, \ 257 2, \ 258 9, \ 259 replace_disp9ls, \ 260 bitfield, \ 261 ( ( ( S + A ) - SECTSTART ) >> 2 )) 262 263ARC_RELOC_HOWTO(AC_SECTFOFF_S9, 38, \ 264 2, \ 265 9, \ 266 replace_disp9ls, \ 267 bitfield, \ 268 ( ( S + A ) - SECTSTART )) 269 270ARC_RELOC_HOWTO(AC_SECTFOFF_S9_1, 39, \ 271 2, \ 272 9, \ 273 replace_disp9ls, \ 274 bitfield, \ 275 ( ( ( S + A ) - SECTSTART ) >> 1 )) 276 277ARC_RELOC_HOWTO(AC_SECTFOFF_S9_2, 40, \ 278 2, \ 279 9, \ 280 replace_disp9ls, \ 281 bitfield, \ 282 ( ( ( S + A ) - SECTSTART ) >> 2 )) 283 284ARC_RELOC_HOWTO(ARC_SECTOFF_ME_1, 41, \ 285 2, \ 286 32, \ 287 replace_word32, \ 288 bitfield, \ 289 ( ME ( ( ( ( S - SECTSTART ) + A ) >> 1 ) ) )) 290 291ARC_RELOC_HOWTO(ARC_SECTOFF_ME_2, 42, \ 292 2, \ 293 32, \ 294 replace_word32, \ 295 bitfield, \ 296 ( ME ( ( ( ( S - SECTSTART ) + A ) >> 2 ) ) )) 297 298ARC_RELOC_HOWTO(ARC_SECTOFF_1, 43, \ 299 2, \ 300 32, \ 301 replace_word32, \ 302 bitfield, \ 303 ( ( ( S - SECTSTART ) + A ) >> 1 )) 304 305ARC_RELOC_HOWTO(ARC_SECTOFF_2, 44, \ 306 2, \ 307 32, \ 308 replace_word32, \ 309 bitfield, \ 310 ( ( ( S - SECTSTART ) + A ) >> 2 )) 311 312ARC_RELOC_HOWTO(ARC_SDA16_ST2, 48, \ 313 1, \ 314 9, \ 315 replace_disp9s1, \ 316 signed, \ 317 ( ( ( S + A ) - _SDA_BASE_ ) >> 2 )) 318 319ARC_RELOC_HOWTO(ARC_32_PCREL, 49, \ 320 2, \ 321 32, \ 322 replace_word32, \ 323 signed, \ 324 ( ( S + A ) - PDATA )) 325 326ARC_RELOC_HOWTO(ARC_PC32, 50, \ 327 2, \ 328 32, \ 329 replace_word32, \ 330 signed, \ 331 ( ME ( ( ( S + A ) - P ) ) )) 332 333ARC_RELOC_HOWTO(ARC_GOT32, 59, \ 334 2, \ 335 32, \ 336 replace_word32, \ 337 dont, \ 338 ( G + A )) 339 340ARC_RELOC_HOWTO(ARC_GOTPC32, 51, \ 341 2, \ 342 32, \ 343 replace_word32, \ 344 signed, \ 345 ( ME ( ( ( ( GOT + G ) + A ) - P ) ) )) 346 347ARC_RELOC_HOWTO(ARC_PLT32, 52, \ 348 2, \ 349 32, \ 350 replace_word32, \ 351 signed, \ 352 ( ME ( ( ( L + A ) - P ) ) )) 353 354ARC_RELOC_HOWTO(ARC_COPY, 53, \ 355 2, \ 356 0, \ 357 replace_none, \ 358 signed, \ 359 none) 360 361ARC_RELOC_HOWTO(ARC_GLOB_DAT, 54, \ 362 2, \ 363 32, \ 364 replace_word32, \ 365 signed, \ 366 S) 367 368ARC_RELOC_HOWTO(ARC_JMP_SLOT, 55, \ 369 2, \ 370 32, \ 371 replace_word32, \ 372 signed, \ 373 ( ME ( S ) )) 374 375ARC_RELOC_HOWTO(ARC_RELATIVE, 56, \ 376 2, \ 377 32, \ 378 replace_word32, \ 379 signed, \ 380 ( ME ( ( B + A ) ) )) 381 382ARC_RELOC_HOWTO(ARC_GOTOFF, 57, \ 383 2, \ 384 32, \ 385 replace_word32, \ 386 signed, \ 387 ( ME ( ( ( S + A ) - GOT ) ) )) 388 389ARC_RELOC_HOWTO(ARC_GOTPC, 58, \ 390 2, \ 391 32, \ 392 replace_word32, \ 393 signed, \ 394 ( ME ( ( GOT_BEGIN - P ) ) )) 395 396ARC_RELOC_HOWTO(ARC_S21W_PCREL_PLT, 60, \ 397 2, \ 398 19, \ 399 replace_disp21w, \ 400 signed, \ 401 ( ME ( ( ( ( L + A ) - P ) >> 2 ) ) )) 402 403ARC_RELOC_HOWTO(ARC_S25H_PCREL_PLT, 61, \ 404 2, \ 405 24, \ 406 replace_disp25h, \ 407 signed, \ 408 ( ME ( ( ( ( L + A ) - P ) >> 1 ) ) )) 409 410ARC_RELOC_HOWTO(ARC_TLS_DTPMOD, 66, \ 411 2, \ 412 32, \ 413 replace_word32, \ 414 dont, \ 415 0) 416 417ARC_RELOC_HOWTO(ARC_TLS_TPOFF, 68, \ 418 2, \ 419 32, \ 420 replace_word32, \ 421 dont, \ 422 0) 423 424ARC_RELOC_HOWTO(ARC_TLS_GD_GOT, 69, \ 425 2, \ 426 32, \ 427 replace_word32, \ 428 dont, \ 429 ( ME ( ( ( G + GOT ) - P ) ) )) 430 431ARC_RELOC_HOWTO(ARC_TLS_GD_LD, 70, \ 432 2, \ 433 0, \ 434 replace_none, \ 435 dont, \ 436 0) 437 438ARC_RELOC_HOWTO(ARC_TLS_GD_CALL, 71, \ 439 2, \ 440 32, \ 441 replace_word32, \ 442 dont, \ 443 0) 444 445ARC_RELOC_HOWTO(ARC_TLS_IE_GOT, 72, \ 446 2, \ 447 32, \ 448 replace_word32, \ 449 dont, \ 450 ( ME ( ( ( G + GOT ) - P ) ) )) 451 452ARC_RELOC_HOWTO(ARC_TLS_DTPOFF, 67, \ 453 2, \ 454 32, \ 455 replace_word32, \ 456 dont, \ 457 ( ME ( ( S - TLS_REL ) ) )) 458 459ARC_RELOC_HOWTO(ARC_TLS_DTPOFF_S9, 73, \ 460 2, \ 461 32, \ 462 replace_word32, \ 463 dont, \ 464 ( ME ( ( S - TLS_REL ) ) )) 465 466ARC_RELOC_HOWTO(ARC_TLS_LE_S9, 74, \ 467 2, \ 468 32, \ 469 replace_word32, \ 470 dont, \ 471 ( ME ( ( ( S + TCB_SIZE ) - TLS_REL ) ) )) 472 473ARC_RELOC_HOWTO(ARC_TLS_LE_32, 75, \ 474 2, \ 475 32, \ 476 replace_word32, \ 477 dont, \ 478 ( ME ( ( ( ( S + A ) + TCB_SIZE ) - TLS_REL ) ) )) 479 480ARC_RELOC_HOWTO(ARC_S25W_PCREL_PLT, 76, \ 481 2, \ 482 23, \ 483 replace_disp25w, \ 484 signed, \ 485 ( ME ( ( ( ( L + A ) - P ) >> 2 ) ) )) 486 487ARC_RELOC_HOWTO(ARC_S21H_PCREL_PLT, 77, \ 488 2, \ 489 20, \ 490 replace_disp21h, \ 491 signed, \ 492 ( ME ( ( ( ( L + A ) - P ) >> 1 ) ) )) 493 494ARC_RELOC_HOWTO(ARC_NPS_CMEM16, 78, \ 495 2, \ 496 16, \ 497 replace_bits16, \ 498 dont, \ 499 ( ME ( S + A ))) 500