include/elf/
authorAlan Modra <amodra@gmail.com>
Wed, 12 Jan 2005 11:28:28 +0000 (11:28 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 12 Jan 2005 11:28:28 +0000 (11:28 +0000)
* ppc.h (R_PPC_RELAX32_PLT, R_PPC_RELAX32PC_PLT): Define.
(R_PPC_RELAX32, R_PPC_RELAX32PC): Adjust value.
bfd/
* elf32-ppc.c (ppc_elf_howto_raw): Delete RELAX32* entries.
(ppc_elf_relax_section): Use PLT variants of RELAX32 relocs for
reaching PLT.
(ppc_elf_relocate_section): Handle R_PPC_RELAX32_PLT and
R_PPC_RELAX32PC_PLT.

bfd/ChangeLog
bfd/elf32-ppc.c
include/elf/ChangeLog
include/elf/ppc.h

index 2c4b88a..ae281de 100644 (file)
@@ -1,3 +1,11 @@
+2005-01-12  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-ppc.c (ppc_elf_howto_raw): Delete RELAX32* entries.
+       (ppc_elf_relax_section): Use PLT variants of RELAX32 relocs for
+       reaching PLT.
+       (ppc_elf_relocate_section): Handle R_PPC_RELAX32_PLT and
+       R_PPC_RELAX32PC_PLT.
+
 2005-01-11  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Follow indirect and warning
index 86fb760..cafbae0 100644 (file)
@@ -1533,35 +1533,6 @@ static reloc_howto_type ppc_elf_howto_raw[] = {
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */
 
-  /* Phony relocs to handle branch stubs.  */
-  HOWTO (R_PPC_RELAX32,                /* type */
-        0,                     /* rightshift */
-        0,                     /* size */
-        0,                     /* bitsize */
-        FALSE,                 /* pc_relative */
-        0,                     /* bitpos */
-        complain_overflow_dont, /* complain_on_overflow */
-        bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_RELAX32",       /* name */
-        FALSE,                 /* partial_inplace */
-        0,                     /* src_mask */
-        0,                     /* dst_mask */
-        FALSE),                /* pcrel_offset */
-
-  HOWTO (R_PPC_RELAX32PC,      /* type */
-        0,                     /* rightshift */
-        0,                     /* size */
-        0,                     /* bitsize */
-        FALSE,                 /* pc_relative */
-        0,                     /* bitpos */
-        complain_overflow_dont, /* complain_on_overflow */
-        bfd_elf_generic_reloc, /* special_function */
-        "R_PPC_RELAX32PC",     /* name */
-        FALSE,                 /* partial_inplace */
-        0,                     /* src_mask */
-        0,                     /* dst_mask */
-        FALSE),                /* pcrel_offset */
-
   /* GNU extension to record C++ vtable hierarchy.  */
   HOWTO (R_PPC_GNU_VTINHERIT,  /* type */
         0,                     /* rightshift */
@@ -1867,6 +1838,12 @@ ppc_elf_relax_section (bfd *abfd,
              stub_rtype = R_PPC_RELAX32;
            }
 
+         if (R_PPC_RELAX32_PLT - R_PPC_RELAX32
+             != R_PPC_RELAX32PC_PLT - R_PPC_RELAX32PC)
+           abort ();
+         if (tsec == ppc_info->plt)
+           stub_rtype += R_PPC_RELAX32_PLT - R_PPC_RELAX32;
+
          /* Hijack the old relocation.  Since we need two
             relocations for this use a "composite" reloc.  */
          irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
@@ -5422,12 +5399,27 @@ ppc_elf_relocate_section (bfd *output_bfd,
            }
          break;
 
+       case R_PPC_RELAX32PC_PLT:
+       case R_PPC_RELAX32_PLT:
+         BFD_ASSERT (h != NULL
+                     && h->plt.offset != (bfd_vma) -1
+                     && htab->plt != NULL);
+
+         relocation = (htab->plt->output_section->vma
+                       + htab->plt->output_offset
+                       + h->plt.offset);
+         if (r_type == R_PPC_RELAX32_PLT)
+           goto relax32;
+         /* Fall thru */
+
        case R_PPC_RELAX32PC:
          relocation -= (input_section->output_section->vma
                         + input_section->output_offset
                         + rel->r_offset - 4);
          /* Fall thru */
+
        case R_PPC_RELAX32:
+       relax32:
          {
            unsigned long t0;
            unsigned long t1;
index 0c49618..6ff970f 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-12  Alan Modra  <amodra@bigpond.net.au>
+
+       * ppc.h (R_PPC_RELAX32_PLT, R_PPC_RELAX32PC_PLT): Define.
+       (R_PPC_RELAX32, R_PPC_RELAX32PC): Adjust value.
+
 2004-12-22  Klaus Rudolph  <lts-rudolph@gmx.de>
        
        * include/elf/avr.h (R_AVR_LDI, R_AVR_6, R_AVR_6_ADIW): New
index b510f44..f512630 100644 (file)
@@ -122,8 +122,10 @@ START_RELOC_NUMBERS (elf_ppc_reloc_type)
 
 /* Fake relocations for branch stubs. This will keep them
    together.  */
-#define R_PPC_RELAX32 251
-#define R_PPC_RELAX32PC 252
+#define R_PPC_RELAX32 249
+#define R_PPC_RELAX32PC 250
+#define R_PPC_RELAX32_PLT 251
+#define R_PPC_RELAX32PC_PLT 252
 
 /* These are GNU extensions to enable C++ vtable garbage collection.  */
   RELOC_NUMBER (R_PPC_GNU_VTINHERIT,   253)