~ubuntu-branches/debian/squeeze/binutils/squeeze

« back to all changes in this revision

Viewing changes to bfd/elf64-ppc.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-09-10 17:05:30 UTC
  • mfrom: (1.4.5 upstream) (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090910170530-wa6gpju9pq5c56on
Tags: 2.19.91.20090910-1
* Snapshot, taken from the 2.20 release branch 20090910, corresponding
  to the 2.19.90 upstream snapshot.
* Fix Thumb-2 shared libraries (Daniel Jacobowitz), patch taken
  from the trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1874
1874
         0xffff,                /* dst_mask */
1875
1875
         FALSE),                /* pcrel_offset */
1876
1876
 
 
1877
  HOWTO (R_PPC64_JMP_IREL,      /* type */
 
1878
         0,                     /* rightshift */
 
1879
         0,                     /* size (0=byte, 1=short, 2=long, 4=64 bits) */
 
1880
         0,                     /* bitsize */
 
1881
         FALSE,                 /* pc_relative */
 
1882
         0,                     /* bitpos */
 
1883
         complain_overflow_dont, /* complain_on_overflow */
 
1884
         ppc64_elf_unhandled_reloc, /* special_function */
 
1885
         "R_PPC64_JMP_IREL",    /* name */
 
1886
         FALSE,                 /* partial_inplace */
 
1887
         0,                     /* src_mask */
 
1888
         0,                     /* dst_mask */
 
1889
         FALSE),                /* pcrel_offset */
 
1890
 
1877
1891
  HOWTO (R_PPC64_IRELATIVE,     /* type */
1878
1892
         0,                     /* rightshift */
1879
1893
         4,                     /* size (0=byte, 1=short, 2=long, 4=64 bits) */
1888
1902
         ONES (64),             /* dst_mask */
1889
1903
         FALSE),                /* pcrel_offset */
1890
1904
 
 
1905
  /* A 16 bit relative relocation.  */
 
1906
  HOWTO (R_PPC64_REL16,         /* type */
 
1907
         0,                     /* rightshift */
 
1908
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
 
1909
         16,                    /* bitsize */
 
1910
         TRUE,                  /* pc_relative */
 
1911
         0,                     /* bitpos */
 
1912
         complain_overflow_bitfield, /* complain_on_overflow */
 
1913
         bfd_elf_generic_reloc, /* special_function */
 
1914
         "R_PPC64_REL16",       /* name */
 
1915
         FALSE,                 /* partial_inplace */
 
1916
         0,                     /* src_mask */
 
1917
         0xffff,                /* dst_mask */
 
1918
         TRUE),                 /* pcrel_offset */
 
1919
 
 
1920
  /* A 16 bit relative relocation without overflow.  */
 
1921
  HOWTO (R_PPC64_REL16_LO,      /* type */
 
1922
         0,                     /* rightshift */
 
1923
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
 
1924
         16,                    /* bitsize */
 
1925
         TRUE,                  /* pc_relative */
 
1926
         0,                     /* bitpos */
 
1927
         complain_overflow_dont,/* complain_on_overflow */
 
1928
         bfd_elf_generic_reloc, /* special_function */
 
1929
         "R_PPC64_REL16_LO",    /* name */
 
1930
         FALSE,                 /* partial_inplace */
 
1931
         0,                     /* src_mask */
 
1932
         0xffff,                /* dst_mask */
 
1933
         TRUE),                 /* pcrel_offset */
 
1934
 
 
1935
  /* The high order 16 bits of a relative address.  */
 
1936
  HOWTO (R_PPC64_REL16_HI,      /* type */
 
1937
         16,                    /* rightshift */
 
1938
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
 
1939
         16,                    /* bitsize */
 
1940
         TRUE,                  /* pc_relative */
 
1941
         0,                     /* bitpos */
 
1942
         complain_overflow_dont, /* complain_on_overflow */
 
1943
         bfd_elf_generic_reloc, /* special_function */
 
1944
         "R_PPC64_REL16_HI",    /* name */
 
1945
         FALSE,                 /* partial_inplace */
 
1946
         0,                     /* src_mask */
 
1947
         0xffff,                /* dst_mask */
 
1948
         TRUE),                 /* pcrel_offset */
 
1949
 
 
1950
  /* The high order 16 bits of a relative address, plus 1 if the contents of
 
1951
     the low 16 bits, treated as a signed number, is negative.  */
 
1952
  HOWTO (R_PPC64_REL16_HA,      /* type */
 
1953
         16,                    /* rightshift */
 
1954
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
 
1955
         16,                    /* bitsize */
 
1956
         TRUE,                  /* pc_relative */
 
1957
         0,                     /* bitpos */
 
1958
         complain_overflow_dont, /* complain_on_overflow */
 
1959
         ppc64_elf_ha_reloc,    /* special_function */
 
1960
         "R_PPC64_REL16_HA",    /* name */
 
1961
         FALSE,                 /* partial_inplace */
 
1962
         0,                     /* src_mask */
 
1963
         0xffff,                /* dst_mask */
 
1964
         TRUE),                 /* pcrel_offset */
 
1965
 
1891
1966
  /* GNU extension to record C++ vtable hierarchy.  */
1892
1967
  HOWTO (R_PPC64_GNU_VTINHERIT, /* type */
1893
1968
         0,                     /* rightshift */
2156
2231
      break;
2157
2232
    case BFD_RELOC_PPC64_DTPREL16_HIGHESTA:     r = R_PPC64_DTPREL16_HIGHESTA;
2158
2233
      break;
 
2234
    case BFD_RELOC_16_PCREL:                    r = R_PPC64_REL16;
 
2235
      break;
 
2236
    case BFD_RELOC_LO16_PCREL:                  r = R_PPC64_REL16_LO;
 
2237
      break;
 
2238
    case BFD_RELOC_HI16_PCREL:                  r = R_PPC64_REL16_HI;
 
2239
      break;
 
2240
    case BFD_RELOC_HI16_S_PCREL:                r = R_PPC64_REL16_HA;
 
2241
      break;
2159
2242
    case BFD_RELOC_VTABLE_INHERIT:              r = R_PPC64_GNU_VTINHERIT;
2160
2243
      break;
2161
2244
    case BFD_RELOC_VTABLE_ENTRY:                r = R_PPC64_GNU_VTENTRY;
4763
4846
 
4764
4847
      tls_type = 0;
4765
4848
      ifunc = NULL;
 
4849
      if (h != NULL)
 
4850
        {
 
4851
          if (h->type == STT_GNU_IFUNC)
 
4852
            {
 
4853
              h->needs_plt = 1;
 
4854
              ifunc = &h->plt.plist;
 
4855
            }
 
4856
        }
 
4857
      else
 
4858
        {
 
4859
          Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache,
 
4860
                                                          abfd, r_symndx);
 
4861
          if (isym == NULL)
 
4862
            return FALSE;
 
4863
 
 
4864
          if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
 
4865
            {
 
4866
              ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
 
4867
                                             rel->r_addend, PLT_IFUNC);
 
4868
              if (ifunc == NULL)
 
4869
                return FALSE;
 
4870
            }
 
4871
        }
4766
4872
      r_type = ELF64_R_TYPE (rel->r_info);
4767
4873
      if (is_branch_reloc (r_type))
4768
4874
        {
4780
4886
            }
4781
4887
 
4782
4888
          /* STT_GNU_IFUNC symbols must have a PLT entry.  */
4783
 
          if (h != NULL)
4784
 
            {
4785
 
              if (h->type == STT_GNU_IFUNC)
4786
 
                {
4787
 
                  h->needs_plt = 1;
4788
 
                  ifunc = &h->plt.plist;
4789
 
                }
4790
 
            }
4791
 
          else
4792
 
            {
4793
 
              Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache,
4794
 
                                                              abfd, r_symndx);
4795
 
              if (isym == NULL)
4796
 
                return FALSE;
4797
 
 
4798
 
              if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
4799
 
                {
4800
 
                  ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
4801
 
                                                 rel->r_addend, PLT_IFUNC);
4802
 
                  if (ifunc == NULL)
4803
 
                    return FALSE;
4804
 
                }
4805
 
            }
4806
4889
          if (ifunc != NULL
4807
4890
              && !update_plt_info (abfd, ifunc, rel->r_addend))
4808
4891
            return FALSE;
4944
5027
          break;
4945
5028
 
4946
5029
          /* Nor do these.  */
 
5030
        case R_PPC64_REL16:
 
5031
        case R_PPC64_REL16_LO:
 
5032
        case R_PPC64_REL16_HI:
 
5033
        case R_PPC64_REL16_HA:
 
5034
          break;
 
5035
 
4947
5036
        case R_PPC64_TOC16:
4948
5037
        case R_PPC64_TOC16_LO:
4949
5038
        case R_PPC64_TOC16_HI:
5194
5283
                  && !info->shared
5195
5284
                  && h != NULL
5196
5285
                  && (h->root.type == bfd_link_hash_defweak
5197
 
                      || !h->def_regular)))
 
5286
                      || !h->def_regular))
 
5287
              || (!info->shared
 
5288
                  && ifunc != NULL))
5198
5289
            {
5199
5290
              struct ppc_dyn_relocs *p;
5200
5291
              struct ppc_dyn_relocs **head;
7990
8081
      for (pent = h->plt.plist; pent != NULL; pent = pent->next)
7991
8082
        if (pent->plt.refcount > 0)
7992
8083
          {
7993
 
            if (!htab->elf.dynamic_sections_created)
 
8084
            if (!htab->elf.dynamic_sections_created
 
8085
                || h->dynindx == -1)
7994
8086
              {
7995
8087
                s = htab->iplt;
7996
8088
                pent->plt.offset = s->size;
8069
8161
    if (gent->got.refcount > 0)
8070
8162
      {
8071
8163
        bfd_boolean dyn;
 
8164
        asection *rsec;
8072
8165
 
8073
8166
        /* Make sure this symbol is output as a dynamic symbol.
8074
8167
           Undefined weak syms won't yet be marked as dynamic,
8075
8168
           nor will all TLS symbols.  */
8076
8169
        if (h->dynindx == -1
8077
8170
            && !h->forced_local
 
8171
            && h->type != STT_GNU_IFUNC
8078
8172
            && htab->elf.dynamic_sections_created)
8079
8173
          {
8080
8174
            if (! bfd_elf_link_record_dynamic_symbol (info, h))
8097
8191
        s->size
8098
8192
          += (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8;
8099
8193
        dyn = htab->elf.dynamic_sections_created;
 
8194
        rsec = NULL;
8100
8195
        if ((info->shared
8101
8196
             || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
8102
8197
            && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
8103
8198
                || h->root.type != bfd_link_hash_undefweak))
8104
 
          ppc64_elf_tdata (gent->owner)->relgot->size
8105
 
            += (gent->tls_type & eh->tls_mask & TLS_GD
8106
 
                ? 2 * sizeof (Elf64_External_Rela)
8107
 
                : sizeof (Elf64_External_Rela));
 
8199
          rsec = ppc64_elf_tdata (gent->owner)->relgot;
 
8200
        else if (h->type == STT_GNU_IFUNC)
 
8201
          rsec = htab->reliplt;
 
8202
        if (rsec != NULL)
 
8203
          rsec->size += (gent->tls_type & eh->tls_mask & TLS_GD
 
8204
                         ? 2 * sizeof (Elf64_External_Rela)
 
8205
                         : sizeof (Elf64_External_Rela));
8108
8206
      }
8109
8207
    else
8110
8208
      gent->got.offset = (bfd_vma) -1;
8111
8209
 
8112
8210
  if (eh->dyn_relocs == NULL
8113
 
      || !htab->elf.dynamic_sections_created)
 
8211
      || (!htab->elf.dynamic_sections_created
 
8212
          && h->type != STT_GNU_IFUNC))
8114
8213
    return TRUE;
8115
8214
 
8116
8215
  /* In the shared -Bsymbolic case, discard space allocated for
8160
8259
            }
8161
8260
        }
8162
8261
    }
 
8262
  else if (h->type == STT_GNU_IFUNC)
 
8263
    {
 
8264
      if (!h->non_got_ref)
 
8265
        eh->dyn_relocs = NULL;
 
8266
    }
8163
8267
  else if (ELIMINATE_COPY_RELOCS)
8164
8268
    {
8165
8269
      /* For the non-shared case, discard space for relocs against
8193
8297
  for (p = eh->dyn_relocs; p != NULL; p = p->next)
8194
8298
    {
8195
8299
      asection *sreloc = elf_section_data (p->sec)->sreloc;
 
8300
      if (!htab->elf.dynamic_sections_created)
 
8301
        sreloc = htab->reliplt;
8196
8302
      sreloc->size += p->count * sizeof (Elf64_External_Rela);
8197
8303
    }
8198
8304
 
8291
8397
              else if (p->count != 0)
8292
8398
                {
8293
8399
                  srel = elf_section_data (p->sec)->sreloc;
 
8400
                  if (!htab->elf.dynamic_sections_created)
 
8401
                    srel = htab->reliplt;
8294
8402
                  srel->size += p->count * sizeof (Elf64_External_Rela);
8295
8403
                  if ((p->sec->output_section->flags & SEC_READONLY) != 0)
8296
8404
                    info->flags |= DF_TEXTREL;
8324
8432
                  }
8325
8433
                else
8326
8434
                  {
 
8435
                    unsigned int num = 1;
8327
8436
                    ent->got.offset = s->size;
8328
8437
                    if ((ent->tls_type & *lgot_masks & TLS_GD) != 0)
8329
 
                      {
8330
 
                        s->size += 16;
8331
 
                        if (info->shared)
8332
 
                          srel->size += 2 * sizeof (Elf64_External_Rela);
8333
 
                      }
8334
 
                    else
8335
 
                      {
8336
 
                        s->size += 8;
8337
 
                        if (info->shared)
8338
 
                          srel->size += sizeof (Elf64_External_Rela);
8339
 
                      }
 
8438
                      num = 2;
 
8439
                    s->size += num * 8;
 
8440
                    if (info->shared)
 
8441
                      srel->size += num * sizeof (Elf64_External_Rela);
 
8442
                    else if ((*lgot_masks & PLT_IFUNC) != 0)
 
8443
                      htab->reliplt->size += num * sizeof (Elf64_External_Rela);
8340
8444
                  }
8341
8445
              }
8342
8446
            else
8356
8460
                ent->plt.offset = s->size;
8357
8461
                s->size += PLT_ENTRY_SIZE;
8358
8462
 
8359
 
                htab->reliplt += sizeof (Elf64_External_Rela);
 
8463
                htab->reliplt->size += sizeof (Elf64_External_Rela);
8360
8464
              }
8361
8465
            else
8362
8466
              ent->plt.offset = (bfd_vma) -1;
9029
9133
        abort ();
9030
9134
 
9031
9135
      plt = htab->plt;
9032
 
      if (!htab->elf.dynamic_sections_created)
 
9136
      if (!htab->elf.dynamic_sections_created
 
9137
          || stub_entry->h == NULL
 
9138
          || stub_entry->h->elf.dynindx == -1)
9033
9139
        plt = htab->iplt;
9034
9140
 
9035
9141
      dest += plt->output_offset + plt->output_section->vma;
9041
9147
          bfd_byte *rl;
9042
9148
 
9043
9149
          rela.r_offset = dest;
9044
 
          rela.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
 
9150
          rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
9045
9151
          rela.r_addend = (stub_entry->target_value
9046
9152
                           + stub_entry->target_section->output_offset
9047
9153
                           + stub_entry->target_section->output_section->vma);
9048
9154
 
9049
 
          if (!htab->elf.dynamic_sections_created)
9050
 
            rl = (htab->reliplt->contents
9051
 
                  + (stub_entry->plt_ent->plt.offset
9052
 
                     / (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
9053
 
          else
9054
 
            rl = (htab->relplt->contents
9055
 
                  + ((stub_entry->plt_ent->plt.offset - PLT_INITIAL_ENTRY_SIZE)
9056
 
                     / (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
9057
 
          bfd_elf32_swap_reloca_out (info->output_bfd, &rela, rl);
 
9155
          rl = (htab->reliplt->contents
 
9156
                + (htab->reliplt->reloc_count++
 
9157
                   * sizeof (Elf64_External_Rela)));
 
9158
          bfd_elf64_swap_reloca_out (info->output_bfd, &rela, rl);
9058
9159
          stub_entry->plt_ent->plt.offset |= 1;
9059
9160
        }
9060
9161
 
9162
9263
      if (off >= (bfd_vma) -2)
9163
9264
        abort ();
9164
9265
      plt = htab->plt;
9165
 
      if (!htab->elf.dynamic_sections_created)
 
9266
      if (!htab->elf.dynamic_sections_created
 
9267
          || stub_entry->h == NULL
 
9268
          || stub_entry->h->elf.dynindx == -1)
9166
9269
        plt = htab->iplt;
9167
9270
      off += (plt->output_offset
9168
9271
              + plt->output_section->vma
11093
11196
                   && sec->output_section != NULL
11094
11197
                   && sec->id <= htab->top_id
11095
11198
                   && (htab->stub_group[sec->id].toc_off
11096
 
                       != htab->stub_group[input_section->id].toc_off)))
 
11199
                       != htab->stub_group[input_section->id].toc_off))
 
11200
               || (h == NULL
 
11201
                   && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC))
11097
11202
              && (stub_entry = ppc_get_stub_entry (input_section, sec, fdh,
11098
11203
                                                   rel, htab)) != NULL
11099
11204
              && (stub_entry->stub_type == ppc_stub_plt_call
11377
11482
                /* Generate relocs for the dynamic linker, except in
11378
11483
                   the case of TLSLD where we'll use one entry per
11379
11484
                   module.  */
11380
 
                asection *relgot = ppc64_elf_tdata (input_bfd)->relgot;
 
11485
                asection *relgot;
 
11486
                bfd_boolean ifunc;
11381
11487
 
11382
11488
                *offp = off | 1;
 
11489
                relgot = NULL;
 
11490
                ifunc = (h != NULL
 
11491
                         ? h->elf.type == STT_GNU_IFUNC
 
11492
                         : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC);
11383
11493
                if ((info->shared || indx != 0)
11384
11494
                    && (offp == &ppc64_tlsld_got (input_bfd)->offset
11385
11495
                        || h == NULL
11386
11496
                        || ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
11387
11497
                        || h->elf.root.type != bfd_link_hash_undefweak))
 
11498
                  relgot = ppc64_elf_tdata (input_bfd)->relgot;
 
11499
                else if (ifunc)
 
11500
                  relgot = htab->reliplt;
 
11501
                if (relgot != NULL)
11388
11502
                  {
11389
11503
                    outrel.r_offset = (got->output_section->vma
11390
11504
                                       + got->output_offset
11411
11525
                      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64);
11412
11526
                    else if (tls_type == (TLS_TLS | TLS_TPREL))
11413
11527
                      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_TPREL64);
11414
 
                    else if (indx == 0)
 
11528
                    else if (indx != 0)
 
11529
                      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT);
 
11530
                    else
11415
11531
                      {
11416
 
                        outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
 
11532
                        if (ifunc)
 
11533
                          outrel.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
 
11534
                        else
 
11535
                          outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
11417
11536
 
11418
11537
                        /* Write the .got section contents for the sake
11419
11538
                           of prelink.  */
11421
11540
                        bfd_put_64 (output_bfd, outrel.r_addend + relocation,
11422
11541
                                    loc);
11423
11542
                      }
11424
 
                    else
11425
 
                      outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT);
11426
11543
 
11427
11544
                    if (indx == 0 && tls_type != (TLS_TLS | TLS_LD))
11428
11545
                      {
11541
11658
            addend -= sec->output_section->vma;
11542
11659
          break;
11543
11660
 
 
11661
        case R_PPC64_REL16:
 
11662
        case R_PPC64_REL16_LO:
 
11663
        case R_PPC64_REL16_HI:
 
11664
        case R_PPC64_REL16_HA:
 
11665
          break;
 
11666
 
11544
11667
        case R_PPC64_REL14:
11545
11668
        case R_PPC64_REL14_BRNTAKEN:
11546
11669
        case R_PPC64_REL14_BRTAKEN:
11633
11756
                  && h != NULL
11634
11757
                  && h->elf.dynindx != -1
11635
11758
                  && !h->elf.non_got_ref
11636
 
                  && !h->elf.def_regular))
 
11759
                  && !h->elf.def_regular)
 
11760
              || (!info->shared
 
11761
                  && (h != NULL
 
11762
                      ? h->elf.type == STT_GNU_IFUNC
 
11763
                      : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))
11637
11764
            {
11638
11765
              Elf_Internal_Rela outrel;
11639
11766
              bfd_boolean skip, relocate;
11698
11825
                             entry in this lib.  */
11699
11826
                          unresolved_reloc = FALSE;
11700
11827
                        }
11701
 
                      outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
 
11828
                      if (!is_opd
 
11829
                          && r_type == R_PPC64_ADDR64
 
11830
                          && (h != NULL
 
11831
                              ? h->elf.type == STT_GNU_IFUNC
 
11832
                              : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC))
 
11833
                        outrel.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
 
11834
                      else
 
11835
                        {
 
11836
                          outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
11702
11837
 
11703
 
                      /* We need to relocate .opd contents for ld.so.
11704
 
                         Prelink also wants simple and consistent rules
11705
 
                         for relocs.  This make all RELATIVE relocs have
11706
 
                         *r_offset equal to r_addend.  */
11707
 
                      relocate = TRUE;
 
11838
                          /* We need to relocate .opd contents for ld.so.
 
11839
                             Prelink also wants simple and consistent rules
 
11840
                             for relocs.  This make all RELATIVE relocs have
 
11841
                             *r_offset equal to r_addend.  */
 
11842
                          relocate = TRUE;
 
11843
                        }
11708
11844
                    }
11709
11845
                  else
11710
11846
                    {
11711
11847
                      long indx = 0;
11712
11848
 
11713
 
                      if (r_symndx == 0 || bfd_is_abs_section (sec))
 
11849
                      if (h != NULL
 
11850
                          ? h->elf.type == STT_GNU_IFUNC
 
11851
                          : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
 
11852
                        {
 
11853
                          (*_bfd_error_handler)
 
11854
                            (_("%B(%A+0x%lx): relocation %s for indirect "
 
11855
                               "function %s unsupported"),
 
11856
                             input_bfd,
 
11857
                             input_section,
 
11858
                             (long) rel->r_offset,
 
11859
                             ppc64_elf_howto_table[r_type]->name,
 
11860
                             sym_name);
 
11861
                          ret = FALSE;
 
11862
                        }
 
11863
                      else if (r_symndx == 0 || bfd_is_abs_section (sec))
11714
11864
                        ;
11715
11865
                      else if (sec == NULL || sec->owner == NULL)
11716
11866
                        {
11748
11898
                }
11749
11899
 
11750
11900
              sreloc = elf_section_data (input_section)->sreloc;
 
11901
              if (!htab->elf.dynamic_sections_created)
 
11902
                sreloc = htab->reliplt;
11751
11903
              if (sreloc == NULL)
11752
11904
                abort ();
11753
11905
 
11789
11941
        case R_PPC64_COPY:
11790
11942
        case R_PPC64_GLOB_DAT:
11791
11943
        case R_PPC64_JMP_SLOT:
 
11944
        case R_PPC64_JMP_IREL:
11792
11945
        case R_PPC64_RELATIVE:
11793
11946
          /* We shouldn't ever see these dynamic relocs in relocatable
11794
11947
             files.  */
11821
11974
          break;
11822
11975
 
11823
11976
        case R_PPC64_ADDR16_HA:
 
11977
        case R_PPC64_REL16_HA:
11824
11978
        case R_PPC64_ADDR16_HIGHERA:
11825
11979
        case R_PPC64_ADDR16_HIGHESTA:
11826
11980
        case R_PPC64_TOC16_HA:
12037
12191
      {
12038
12192
        /* This symbol has an entry in the procedure linkage
12039
12193
           table.  Set it up.  */
12040
 
        asection *plt = htab->plt;
12041
 
        if (!htab->elf.dynamic_sections_created)
12042
 
          plt = htab->iplt;
12043
 
 
12044
 
        rela.r_offset = (plt->output_section->vma
12045
 
                         + plt->output_offset
12046
 
                         + ent->plt.offset);
12047
 
 
12048
12194
        if (!htab->elf.dynamic_sections_created
12049
12195
            || h->dynindx == -1)
12050
12196
          {
12052
12198
                        && h->def_regular
12053
12199
                        && (h->root.type == bfd_link_hash_defined
12054
12200
                            || h->root.type == bfd_link_hash_defweak));
12055
 
            rela.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
 
12201
            rela.r_offset = (htab->iplt->output_section->vma
 
12202
                             + htab->iplt->output_offset
 
12203
                             + ent->plt.offset);
 
12204
            rela.r_info = ELF64_R_INFO (0, R_PPC64_JMP_IREL);
12056
12205
            rela.r_addend = (h->root.u.def.value
12057
12206
                             + h->root.u.def.section->output_offset
12058
12207
                             + h->root.u.def.section->output_section->vma
12059
12208
                             + ent->addend);
 
12209
            loc = (htab->reliplt->contents
 
12210
                   + (htab->reliplt->reloc_count++
 
12211
                      * sizeof (Elf64_External_Rela)));
12060
12212
          }
12061
12213
        else
12062
12214
          {
 
12215
            rela.r_offset = (htab->plt->output_section->vma
 
12216
                             + htab->plt->output_offset
 
12217
                             + ent->plt.offset);
12063
12218
            rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
12064
12219
            rela.r_addend = ent->addend;
 
12220
            loc = (htab->relplt->contents
 
12221
                   + ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE)
 
12222
                      / (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
12065
12223
          }
12066
 
 
12067
 
        if (!htab->elf.dynamic_sections_created)
12068
 
          loc = (htab->reliplt->contents
12069
 
                 + (ent->plt.offset
12070
 
                    / (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
12071
 
        else
12072
 
          loc = (htab->relplt->contents
12073
 
                 + ((ent->plt.offset - PLT_INITIAL_ENTRY_SIZE)
12074
 
                    / (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
12075
12224
        bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
12076
12225
      }
12077
12226