bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCOFF relocation data gets mangled by ld.


From: Alan Modra
Subject: Re: XCOFF relocation data gets mangled by ld.
Date: Tue, 6 Aug 2002 11:58:25 +0930
User-agent: Mutt/1.2.5i

On Tue, Aug 06, 2002 at 08:50:53AM +0930, Alan Modra wrote:
> As expected, the 16 bit relocs are placed differently to gas.  I'll see
> about fixing gas.

The xcoff reloc howto table, and generated howto entry used in linking
had bogus src_mask entries.  Just as well gas generates zeros in the
object files.  This patch corrects that problem, and changes all 16 bit
coff reloc types to have size == 1, as it appears that xcoff tools from
IBM set the reloc offset to point directly at the 16 bit field to be
relocated.  Most of these howto entries aren't used by gas, except the
one used by PPC_BA16 relocs.  Those we're fixing in the assembler to
have the right offset.

bfd/ChangeLog
        * coff-rs6000.c (xcoff_howto_table): Fix src_mask entries.  Make all
        relocs with bitsize == 16 have size = 1.
        (xcoff_reloc_type_ba): Correct src_mask and dst_mask adjustment.
        (xcoff_reloc_type_br): Likewise.
        (xcoff_reloc_type_crel): Likewise.
        (xcoff_ppc_relocate_section): Set up src_mask and dst_mask correctly.
        * coff64-rs6000.c (xcoff64_reloc_type_br): Correct src_mask and
        dst_mask adjustment.
        (xcoff64_ppc_relocate_section): Set up src_mask and dst_mask correctly.
        (xcoff64_howto_table): Fix src_mask entries.  Make all relocs with
        bitsize == 16 have size = 1.

gas/ChangeLog
        * config/tc-ppc.c (md_apply_fix3): Adjust 16 bit XCOFF reloc offset.

Index: coff-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.46
diff -u -p -r1.46 coff-rs6000.c
--- coff-rs6000.c       30 Jul 2002 05:49:24 -0000      1.46
+++ coff-rs6000.c       6 Aug 2002 00:26:49 -0000
@@ -588,7 +588,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_POS",               /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -603,7 +603,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_NEG",               /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -618,7 +618,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_REL",               /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -633,7 +633,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_TOC",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -648,14 +648,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RTB",               /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* External TOC relative symbol.  */
   HOWTO (R_GL,                 /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -663,14 +663,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_GL",                /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Local TOC relative symbol.  */
   HOWTO (R_TCL,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -678,7 +678,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_TCL",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -695,8 +695,8 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_BA_26",             /* name */
         true,                  /* partial_inplace */
-        0x3fffffc,             /* src_mask */
-        0x3fffffc,             /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   EMPTY_HOWTO (9),
@@ -712,8 +712,8 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_BR",                /* name */
         true,                  /* partial_inplace */
-        0x3fffffc,             /* src_mask */
-        0x3fffffc,             /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   EMPTY_HOWTO (0xb),
@@ -721,7 +721,7 @@ reloc_howto_type xcoff_howto_table[] =
   /* Indirect load.  */
   HOWTO (R_RL,                 /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -729,14 +729,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RL",                /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Load address.  */
   HOWTO (R_RLA,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -744,7 +744,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RLA",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -757,7 +757,7 @@ reloc_howto_type xcoff_howto_table[] =
         32,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
-        complain_overflow_bitfield, /* complain_on_overflow */
+        complain_overflow_dont, /* complain_on_overflow */
         0,                     /* special_function */
         "R_REF",               /* name */
         false,                 /* partial_inplace */
@@ -771,7 +771,7 @@ reloc_howto_type xcoff_howto_table[] =
   /* TOC relative indirect load.  */
   HOWTO (R_TRL,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -779,14 +779,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_TRL",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* TOC relative load address.  */
   HOWTO (R_TRLA,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -794,7 +794,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_TRLA",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -809,7 +809,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RRTBI",             /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -824,14 +824,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RRTBA",             /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable call absolute indirect.  */
   HOWTO (R_CAI,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -839,14 +839,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_CAI",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable call relative.  */
   HOWTO (R_CREL,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -854,7 +854,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_CREL",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -869,8 +869,8 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RBA",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
-        0xffff,                /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable branch absolute.  */
@@ -884,8 +884,8 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RBAC",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
-        0xffff,                /* dst_mask */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable branch relative.  */
@@ -899,14 +899,14 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RBR_26",            /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
-        0xffff,                /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable branch absolute.  */
   HOWTO (R_RBRC,                /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -914,7 +914,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RBRC",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -929,7 +929,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_BA_16",             /* name */
         true,                  /* partial_inplace */
-        0xfffc,                /* src_mask */
+        0x0003,                /* src_mask */
         0xfffc,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -944,7 +944,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RBR_16",            /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -959,7 +959,7 @@ reloc_howto_type xcoff_howto_table[] =
         0,                     /* special_function */
         "R_RBA_16",            /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -2885,8 +2885,8 @@ xcoff_reloc_type_ba (input_bfd, input_se
      bfd_vma *relocation;
      bfd_byte *contents ATTRIBUTE_UNUSED;
 {
-  howto->src_mask &= ~3;
-  howto->dst_mask = howto->src_mask;
+  howto->src_mask |= 3;
+  howto->dst_mask &= ~3;
 
   *relocation = val + addend;
 
@@ -2960,8 +2960,8 @@ xcoff_reloc_type_br (input_bfd, input_se
     }
   
   howto->pc_relative = true;
-  howto->src_mask &= ~3;
-  howto->dst_mask = howto->src_mask;
+  howto->src_mask |= 3;
+  howto->dst_mask &= ~3;
 
   /* A PC relative reloc includes the section address.  */
   addend += input_section->vma;
@@ -2987,8 +2987,8 @@ xcoff_reloc_type_crel (input_bfd, input_
      bfd_byte *contents ATTRIBUTE_UNUSED;
 {
   howto->pc_relative = true;
-  howto->src_mask &= ~3;
-  howto->dst_mask = howto->src_mask;
+  howto->src_mask |= 3;
+  howto->dst_mask &= ~3;
 
   /* A PC relative reloc includes the section address.  */
   addend += input_section->vma;
@@ -3348,7 +3348,8 @@ xcoff_ppc_relocate_section (output_bfd, 
       howto.special_function = NULL;
       howto.name = "internal";
       howto.partial_inplace = true;
-      howto.src_mask = howto.dst_mask = N_ONES(howto.bitsize);
+      howto.dst_mask = N_ONES (howto.bitsize);
+      howto.src_mask = ~howto.dst_mask & N_ONES (8 << howto.size);
       howto.pcrel_offset = false;
 
       /* symbol */
Index: coff64-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff64-rs6000.c,v
retrieving revision 1.34
diff -u -p -r1.34 coff64-rs6000.c
--- coff64-rs6000.c     30 Jul 2002 05:49:24 -0000      1.34
+++ coff64-rs6000.c     6 Aug 2002 00:26:50 -0000
@@ -1132,8 +1132,8 @@ xcoff64_reloc_type_br (input_bfd, input_
     }
   
   howto->pc_relative = true;
-  howto->src_mask &= ~3;
-  howto->dst_mask = howto->src_mask;
+  howto->src_mask |= 3;
+  howto->dst_mask &= ~3;
   
   /* A PC relative reloc includes the section address.  */
   addend += input_section->vma;
@@ -1196,7 +1196,8 @@ xcoff64_ppc_relocate_section (output_bfd
       howto.special_function = NULL;
       howto.name = "internal";
       howto.partial_inplace = true;
-      howto.src_mask = howto.dst_mask = N_ONES(howto.bitsize);
+      howto.dst_mask = N_ONES (howto.bitsize);
+      howto.src_mask = ~howto.dst_mask & N_ONES (8 << howto.size);
       howto.pcrel_offset = false;
 
       /* symbol */
@@ -1357,7 +1359,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_POS_64",            /* name */
         true,                  /* partial_inplace */
-        MINUS_ONE,             /* src_mask */
+        0,                     /* src_mask */
         MINUS_ONE,             /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1372,7 +1374,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_NEG",               /* name */
         true,                  /* partial_inplace */
-        MINUS_ONE,             /* src_mask */
+        0,                     /* src_mask */
         MINUS_ONE,             /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1387,7 +1389,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_REL",               /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1402,7 +1404,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_TOC",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1417,14 +1419,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RTB",               /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* External TOC relative symbol.  */
   HOWTO (R_GL,                 /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1432,14 +1434,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_GL",                /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Local TOC relative symbol.         */
   HOWTO (R_TCL,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1447,7 +1449,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_TCL",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1464,8 +1466,8 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_BA_26",             /* name */
         true,                  /* partial_inplace */
-        0x3fffffc,             /* src_mask */
-        0x3fffffc,             /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   EMPTY_HOWTO (9),
@@ -1481,8 +1483,8 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_BR",                /* name */
         true,                  /* partial_inplace */
-        0x3fffffc,             /* src_mask */
-        0x3fffffc,             /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   EMPTY_HOWTO (0xb),
@@ -1490,7 +1492,7 @@ reloc_howto_type xcoff64_howto_table[] =
   /* Indirect load.  */
   HOWTO (R_RL,                 /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1498,14 +1500,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RL",                /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Load address.  */
   HOWTO (R_RLA,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1513,7 +1515,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RLA",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1540,7 +1542,7 @@ reloc_howto_type xcoff64_howto_table[] =
   /* TOC relative indirect load.  */
   HOWTO (R_TRL,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1548,14 +1550,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_TRL",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* TOC relative load address.         */
   HOWTO (R_TRLA,               /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1563,7 +1565,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_TRLA",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1578,7 +1580,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RRTBI",             /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1593,14 +1595,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RRTBA",             /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable call absolute indirect.         */
   HOWTO (R_CAI,                        /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1608,14 +1610,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_CAI",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable call relative.  */
   HOWTO (R_CREL,               /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1623,7 +1625,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_CREL",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1638,8 +1640,8 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RBA",               /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
-        0xffff,                /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable branch absolute.  */
@@ -1653,8 +1655,8 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RBAC",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
-        0xffff,                /* dst_mask */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable branch relative.  */
@@ -1668,14 +1670,14 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RBR_26",            /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
-        0xffff,                /* dst_mask */
+        0xfc000003,            /* src_mask */
+        0x03fffffc,            /* dst_mask */
         false),                /* pcrel_offset */
 
   /* Modifiable branch absolute.  */
   HOWTO (R_RBRC,               /* type */
         0,                     /* rightshift */
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         false,                 /* pc_relative */
         0,                     /* bitpos */
@@ -1683,7 +1685,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RBRC",              /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1697,7 +1699,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_POS_32",            /* name */
         true,                  /* partial_inplace */
-        0xffffffff,            /* src_mask */
+        0,                     /* src_mask */
         0xffffffff,            /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1712,7 +1714,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_BA_16",             /* name */
         true,                  /* partial_inplace */
-        0xfffc,                /* src_mask */
+        0x0003,                /* src_mask */
         0xfffc,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1727,7 +1729,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RBR_16",            /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
@@ -1742,7 +1744,7 @@ reloc_howto_type xcoff64_howto_table[] =
         0,                     /* special_function */
         "R_RBA_16",            /* name */
         true,                  /* partial_inplace */
-        0xffff,                /* src_mask */
+        0,                     /* src_mask */
         0xffff,                /* dst_mask */
         false),                /* pcrel_offset */
 
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.52
diff -u -p -r1.52 tc-ppc.c
--- gas/config/tc-ppc.c 26 Jul 2002 04:18:42 -0000      1.52
+++ gas/config/tc-ppc.c 6 Aug 2002 01:43:00 -0000
@@ -5223,7 +5223,14 @@ md_apply_fix3 (fixP, valP, seg)
       else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
          && operand->bits == 16
          && operand->shift == 0)
-       fixP->fx_r_type = BFD_RELOC_PPC_B16;
+       {
+         fixP->fx_r_type = BFD_RELOC_PPC_B16;
+#ifdef OBJ_XCOFF
+         fixP->fx_size = 2;
+         if (target_big_endian)
+           fixP->fx_where += 2;
+#endif
+       }
       else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0
               && operand->bits == 26
               && operand->shift == 0)
@@ -5231,7 +5238,14 @@ md_apply_fix3 (fixP, valP, seg)
       else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0
               && operand->bits == 16
               && operand->shift == 0)
-       fixP->fx_r_type = BFD_RELOC_PPC_BA16;
+       {
+         fixP->fx_r_type = BFD_RELOC_PPC_BA16;
+#ifdef OBJ_XCOFF
+         fixP->fx_size = 2;
+         if (target_big_endian)
+           fixP->fx_where += 2;
+#endif
+       }
 #if defined (OBJ_XCOFF) || defined (OBJ_ELF)
       else if ((operand->flags & PPC_OPERAND_PARENS) != 0
               && operand->bits == 16


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



reply via email to

[Prev in Thread] Current Thread [Next in Thread]