18 |
PPC_RELOC_HA16_SECTDIFF = 12, /* expects a pair */ |
PPC_RELOC_HA16_SECTDIFF = 12, /* expects a pair */ |
19 |
PPC_RELOC_JBSR = 13, /* expects a pair */ |
PPC_RELOC_JBSR = 13, /* expects a pair */ |
20 |
PPC_RELOC_LO14_SECTDIFF = 14, /* expects a pair */ |
PPC_RELOC_LO14_SECTDIFF = 14, /* expects a pair */ |
21 |
|
PPC_RELOC_LOCAL_SECTDIFF = 15, /* expects a pair */ |
22 |
|
|
23 |
PPC_RELOC_NONE = 255 |
PPC_RELOC_NONE = 255 |
24 |
|
|
25 |
}; |
}; |
26 |
|
#define PPC_RELOC_SENTINEL (PPC_RELOC_LOCAL_SECTDIFF+1) |
27 |
|
|
28 |
|
|
29 |
/* Entries not suffixed by "PCREL" are expected to be absolute. Note, however, |
/* Entries not suffixed by "PCREL" are expected to be absolute. Note, however, |
30 |
that the canonicalization routine does not require this. This means that adding |
that the canonicalization routine does not require this. This means that adding |
52 |
BFD_MACH_O_PPC_RELOC_HI16_SECTDIFF = 14, |
BFD_MACH_O_PPC_RELOC_HI16_SECTDIFF = 14, |
53 |
BFD_MACH_O_PPC_RELOC_LO16_SECTDIFF = 15, |
BFD_MACH_O_PPC_RELOC_LO16_SECTDIFF = 15, |
54 |
BFD_MACH_O_PPC_RELOC_HA16_SECTDIFF = 16, |
BFD_MACH_O_PPC_RELOC_HA16_SECTDIFF = 16, |
55 |
BFD_MACH_O_PPC_RELOC_LO14_SECTDIFF = 17, |
BFD_MACH_O_PPC_RELOC_JBSR = 17, |
56 |
BFD_MACH_O_PPC_RELOC_JBSR = 18 |
BFD_MACH_O_PPC_RELOC_LO14_SECTDIFF = 18, |
57 |
|
BFD_MACH_O_PPC_RELOC_LOCAL_SECTDIFF = 19 |
58 |
|
|
59 |
}; |
}; |
60 |
|
#define BFD_MACH_O_PPC_RELOC_SENTINEL (BFD_MACH_O_PPC_RELOC_LOCAL_SECTDIFF+1) |
61 |
|
|
62 |
#define BFD_MACH_O_R_ABS 0 |
#define BFD_MACH_O_R_ABS 0 |
63 |
#define BFD_MACH_O_R_SCATTERED 0x80000000 |
#define BFD_MACH_O_R_SCATTERED 0x80000000 |
462 |
false /* pcrel_offset */ |
false /* pcrel_offset */ |
463 |
), |
), |
464 |
|
|
465 |
|
/* The jbsr instruction is assembled to the branch island. For |
466 |
|
now, don't bother testing if the target can be reached directly. */ |
467 |
|
|
468 |
/* 17 */ |
/* 17 */ |
469 |
HOWTO( |
HOWTO( |
470 |
|
BFD_MACH_O_PPC_RELOC_JBSR, /* type */ |
471 |
|
0, /* right_shift */ |
472 |
|
2, /* size */ |
473 |
|
26, /* bitsize */ |
474 |
|
false, /* pc_relative */ |
475 |
|
0, /* bitpos */ |
476 |
|
complain_overflow_dont, /* |
477 |
|
omplain_overflow */ |
478 |
|
NULL, /* |
479 |
|
pecial_function */ |
480 |
|
"BFD_MACH_O_PPC_RELOC_JBSR", /* name */ |
481 |
|
false, /* partial_inplace */ |
482 |
|
0, /* src_mask */ |
483 |
|
0, /* dst_mask */ |
484 |
|
false /* pcrel_offset */ |
485 |
|
), |
486 |
|
|
487 |
|
/* 18 */ |
488 |
|
HOWTO( |
489 |
BFD_MACH_O_PPC_RELOC_LO14_SECTDIFF, /* type */ |
BFD_MACH_O_PPC_RELOC_LO14_SECTDIFF, /* type */ |
490 |
0, /* right_shift */ |
0, /* right_shift */ |
491 |
2, /* size */ |
2, /* size */ |
501 |
false /* pcrel_offset */ |
false /* pcrel_offset */ |
502 |
), |
), |
503 |
|
|
504 |
/* The jbsr instruction is assembled to the branch island. For |
/* 19 */ |
|
now, don't bother testing if the target can be reached directly. */ |
|
|
|
|
|
/* 18 */ |
|
505 |
HOWTO( |
HOWTO( |
506 |
BFD_MACH_O_PPC_RELOC_JBSR, /* type */ |
BFD_MACH_O_PPC_RELOC_LOCAL_SECTDIFF, /* type */ |
507 |
0, /* right_shift */ |
0, /* right_shift */ |
508 |
2, /* size */ |
2, /* size */ |
509 |
26, /* bitsize */ |
32, /* bitsize */ |
510 |
false, /* pc_relative */ |
false, /* pc_relative */ |
511 |
0, /* bitpos */ |
0, /* bitpos */ |
512 |
complain_overflow_dont, /* complain_overflow */ |
complain_overflow_dont, /* complain_overflow */ |
513 |
NULL, /* special_function */ |
bfd_mach_o_sectdiff_reloc, /* special_function */ |
514 |
"BFD_MACH_O_PPC_RELOC_JBSR", /* name */ |
"BFD_MACH_O_PPC_RELOC_LOCAL_SECTDIFF", /* name */ |
515 |
false, /* partial_inplace */ |
false, /* partial_inplace */ |
516 |
0, /* src_mask */ |
0, /* src_mask */ |
517 |
0, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
518 |
false /* pcrel_offset */ |
false /* pcrel_offset */ |
519 |
) |
) |
520 |
|
|
537 |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_HA16_SECTDIFF], |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_HA16_SECTDIFF], |
538 |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_JBSR], |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_JBSR], |
539 |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_LO14_SECTDIFF], |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_LO14_SECTDIFF], |
540 |
|
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_LOCAL_SECTDIFF], |
541 |
NULL, |
NULL, |
542 |
NULL, |
NULL, |
543 |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_BR14_PCREL], |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_BR14_PCREL], |
552 |
NULL, |
NULL, |
553 |
NULL, |
NULL, |
554 |
NULL, |
NULL, |
555 |
|
NULL, |
556 |
NULL |
NULL |
557 |
|
|
558 |
}; |
}; |
626 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
627 |
bfd_reloc_code_real_type code; |
bfd_reloc_code_real_type code; |
628 |
{ |
{ |
629 |
if (code <= BFD_MACH_O_PPC_RELOC_JBSR) { |
if (code < BFD_MACH_O_PPC_RELOC_SENTINEL) { |
630 |
return reloc_howto_table + code; |
return reloc_howto_table + code; |
631 |
} else { |
} else { |
632 |
return NULL; |
return NULL; |
934 |
r_type == PPC_RELOC_HI16_SECTDIFF || |
r_type == PPC_RELOC_HI16_SECTDIFF || |
935 |
r_type == PPC_RELOC_LO16_SECTDIFF || |
r_type == PPC_RELOC_LO16_SECTDIFF || |
936 |
r_type == PPC_RELOC_HA16_SECTDIFF || |
r_type == PPC_RELOC_HA16_SECTDIFF || |
937 |
r_type == PPC_RELOC_LO14_SECTDIFF) |
r_type == PPC_RELOC_LO14_SECTDIFF || |
938 |
|
r_type == PPC_RELOC_LOCAL_SECTDIFF) |
939 |
{ |
{ |
940 |
struct scattered_relocation_info *srip = NULL; |
struct scattered_relocation_info *srip = NULL; |
941 |
enum bfd_mach_o_rtype pair_r_type = PPC_RELOC_NONE; |
enum bfd_mach_o_rtype pair_r_type = PPC_RELOC_NONE; |
974 |
|
|
975 |
octets = relent->address * bfd_octets_per_byte (abfd); |
octets = relent->address * bfd_octets_per_byte (abfd); |
976 |
|
|
977 |
if (r_type == PPC_RELOC_VANILLA || r_type == PPC_RELOC_SECTDIFF) |
if (r_type == PPC_RELOC_VANILLA || r_type == PPC_RELOC_SECTDIFF || r_type == PPC_RELOC_LOCAL_SECTDIFF) |
978 |
{ |
{ |
979 |
switch (r_length) |
switch (r_length) |
980 |
{ |
{ |
1041 |
break; |
break; |
1042 |
|
|
1043 |
default: |
default: |
1044 |
fprintf (stderr, "error: unknown relocation entry\n"); |
fprintf (stderr, "error: unknown relocation entry, r_type=0x%x\n",r_type); |
1045 |
return false; |
return false; |
1046 |
} |
} |
1047 |
} |
} |
1096 |
r_type == PPC_RELOC_HI16_SECTDIFF || |
r_type == PPC_RELOC_HI16_SECTDIFF || |
1097 |
r_type == PPC_RELOC_LO16_SECTDIFF || |
r_type == PPC_RELOC_LO16_SECTDIFF || |
1098 |
r_type == PPC_RELOC_HA16_SECTDIFF || |
r_type == PPC_RELOC_HA16_SECTDIFF || |
1099 |
r_type == PPC_RELOC_LO14_SECTDIFF) |
r_type == PPC_RELOC_LO14_SECTDIFF || |
1100 |
|
r_type == PPC_RELOC_LOCAL_SECTDIFF) |
1101 |
{ |
{ |
1102 |
bfd_mach_o_sectdiff *sectdiff = (bfd_mach_o_sectdiff *) |
bfd_mach_o_sectdiff *sectdiff = (bfd_mach_o_sectdiff *) |
1103 |
bfd_alloc (abfd, sizeof (bfd_mach_o_sectdiff)); |
bfd_alloc (abfd, sizeof (bfd_mach_o_sectdiff)); |
1126 |
|
|
1127 |
relent->howto = NULL; |
relent->howto = NULL; |
1128 |
|
|
1129 |
if ((r_type + (PPC_RELOC_LO14_SECTDIFF+1) * r_pcrel) < sizeof (to_howto)) |
if ((r_type + PPC_RELOC_SENTINEL * r_pcrel) < sizeof (to_howto)) |
1130 |
{ |
{ |
1131 |
relent->howto = |
relent->howto = |
1132 |
to_howto [r_type + (PPC_RELOC_LO14_SECTDIFF+1) * r_pcrel]; |
to_howto [r_type + PPC_RELOC_SENTINEL * r_pcrel]; |
1133 |
|
|
1134 |
if (relent->howto == |
if (relent->howto == |
1135 |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_VANILLA_2]) |
& reloc_howto_table [BFD_MACH_O_PPC_RELOC_VANILLA_2]) |