/[gcl]/gcl/binutils/bfd/mach-o-reloc.c
ViewVC logotype

Diff of /gcl/binutils/bfd/mach-o-reloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.2 by rlbrk, Fri Mar 12 08:16:03 2004 UTC revision 1.1.2.2.14.1 by camm, Wed Nov 30 20:25:16 2005 UTC
# Line 18  enum bfd_mach_o_rtype { Line 18  enum bfd_mach_o_rtype {
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
# Line 49  enum bfd_reloc_code_real_type { Line 52  enum bfd_reloc_code_real_type {
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
# Line 457  reloc_howto_type reloc_howto_table [] = Line 462  reloc_howto_type reloc_howto_table [] =
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 */
# Line 474  reloc_howto_type reloc_howto_table [] = Line 501  reloc_howto_type reloc_howto_table [] =
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    
# Line 513  static reloc_howto_type *to_howto [] = { Line 537  static reloc_howto_type *to_howto [] = {
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],
# Line 528  static reloc_howto_type *to_howto [] = { Line 552  static reloc_howto_type *to_howto [] = {
552    NULL,    NULL,
553    NULL,    NULL,
554    NULL,    NULL,
555      NULL,
556    NULL    NULL
557    
558  };  };
# Line 601  bfd_mach_o_bfd_reloc_type_lookup (abfd, Line 626  bfd_mach_o_bfd_reloc_type_lookup (abfd,
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;
# Line 909  bfd_mach_o_slurp_relocation_entries (abf Line 934  bfd_mach_o_slurp_relocation_entries (abf
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;
# Line 948  bfd_mach_o_slurp_relocation_entries (abf Line 974  bfd_mach_o_slurp_relocation_entries (abf
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              {              {
# Line 1015  bfd_mach_o_slurp_relocation_entries (abf Line 1041  bfd_mach_o_slurp_relocation_entries (abf
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          }          }
# Line 1070  bfd_mach_o_slurp_relocation_entries (abf Line 1096  bfd_mach_o_slurp_relocation_entries (abf
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));
# Line 1099  bfd_mach_o_slurp_relocation_entries (abf Line 1126  bfd_mach_o_slurp_relocation_entries (abf
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])

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.2.14.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26