1874
1874
0xffff, /* dst_mask */
1875
1875
FALSE), /* pcrel_offset */
1877
HOWTO (R_PPC64_JMP_IREL, /* type */
1879
0, /* size (0=byte, 1=short, 2=long, 4=64 bits) */
1881
FALSE, /* pc_relative */
1883
complain_overflow_dont, /* complain_on_overflow */
1884
ppc64_elf_unhandled_reloc, /* special_function */
1885
"R_PPC64_JMP_IREL", /* name */
1886
FALSE, /* partial_inplace */
1889
FALSE), /* pcrel_offset */
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 */
1905
/* A 16 bit relative relocation. */
1906
HOWTO (R_PPC64_REL16, /* type */
1908
1, /* size (0 = byte, 1 = short, 2 = long) */
1910
TRUE, /* pc_relative */
1912
complain_overflow_bitfield, /* complain_on_overflow */
1913
bfd_elf_generic_reloc, /* special_function */
1914
"R_PPC64_REL16", /* name */
1915
FALSE, /* partial_inplace */
1917
0xffff, /* dst_mask */
1918
TRUE), /* pcrel_offset */
1920
/* A 16 bit relative relocation without overflow. */
1921
HOWTO (R_PPC64_REL16_LO, /* type */
1923
1, /* size (0 = byte, 1 = short, 2 = long) */
1925
TRUE, /* pc_relative */
1927
complain_overflow_dont,/* complain_on_overflow */
1928
bfd_elf_generic_reloc, /* special_function */
1929
"R_PPC64_REL16_LO", /* name */
1930
FALSE, /* partial_inplace */
1932
0xffff, /* dst_mask */
1933
TRUE), /* pcrel_offset */
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) */
1940
TRUE, /* pc_relative */
1942
complain_overflow_dont, /* complain_on_overflow */
1943
bfd_elf_generic_reloc, /* special_function */
1944
"R_PPC64_REL16_HI", /* name */
1945
FALSE, /* partial_inplace */
1947
0xffff, /* dst_mask */
1948
TRUE), /* pcrel_offset */
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) */
1956
TRUE, /* pc_relative */
1958
complain_overflow_dont, /* complain_on_overflow */
1959
ppc64_elf_ha_reloc, /* special_function */
1960
"R_PPC64_REL16_HA", /* name */
1961
FALSE, /* partial_inplace */
1963
0xffff, /* dst_mask */
1964
TRUE), /* pcrel_offset */
1891
1966
/* GNU extension to record C++ vtable hierarchy. */
1892
1967
HOWTO (R_PPC64_GNU_VTINHERIT, /* type */
1893
1968
0, /* rightshift */
4851
if (h->type == STT_GNU_IFUNC)
4854
ifunc = &h->plt.plist;
4859
Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache,
4864
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
4866
ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
4867
rel->r_addend, PLT_IFUNC);
4766
4872
r_type = ELF64_R_TYPE (rel->r_info);
4767
4873
if (is_branch_reloc (r_type))
4782
4888
/* STT_GNU_IFUNC symbols must have a PLT entry. */
4785
if (h->type == STT_GNU_IFUNC)
4788
ifunc = &h->plt.plist;
4793
Elf_Internal_Sym *isym = bfd_sym_from_r_symndx (&htab->sym_cache,
4798
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
4800
ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
4801
rel->r_addend, PLT_IFUNC);
4806
4889
if (ifunc != NULL
4807
4890
&& !update_plt_info (abfd, ifunc, rel->r_addend))
8069
8161
if (gent->got.refcount > 0)
8071
8163
bfd_boolean dyn;
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)
8080
8174
if (! bfd_elf_link_record_dynamic_symbol (info, h))
8098
8192
+= (gent->tls_type & eh->tls_mask & (TLS_GD | TLS_LD)) ? 16 : 8;
8099
8193
dyn = htab->elf.dynamic_sections_created;
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;
8203
rsec->size += (gent->tls_type & eh->tls_mask & TLS_GD
8204
? 2 * sizeof (Elf64_External_Rela)
8205
: sizeof (Elf64_External_Rela));
8110
8208
gent->got.offset = (bfd_vma) -1;
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))
8116
8215
/* In the shared -Bsymbolic case, discard space allocated for
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);
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))));
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;
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))
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
11380
asection *relgot = ppc64_elf_tdata (input_bfd)->relgot;
11382
11488
*offp = off | 1;
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
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;
11500
relgot = htab->reliplt;
11501
if (relgot != NULL)
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);
11416
outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE);
11533
outrel.r_info = ELF64_R_INFO (0, R_PPC64_IRELATIVE);
11535
outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
11418
11537
/* Write the .got section contents for the sake
11419
11538
of prelink. */
11698
11825
entry in this lib. */
11699
11826
unresolved_reloc = FALSE;
11701
outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
11829
&& r_type == R_PPC64_ADDR64
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);
11836
outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
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. */
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. */
11711
11847
long indx = 0;
11713
if (r_symndx == 0 || bfd_is_abs_section (sec))
11850
? h->elf.type == STT_GNU_IFUNC
11851
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
11853
(*_bfd_error_handler)
11854
(_("%B(%A+0x%lx): relocation %s for indirect "
11855
"function %s unsupported"),
11858
(long) rel->r_offset,
11859
ppc64_elf_howto_table[r_type]->name,
11863
else if (r_symndx == 0 || bfd_is_abs_section (sec))
11715
11865
else if (sec == NULL || sec->owner == NULL)
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)));
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))));
12067
if (!htab->elf.dynamic_sections_created)
12068
loc = (htab->reliplt->contents
12070
/ (PLT_ENTRY_SIZE / sizeof (Elf64_External_Rela))));
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);