2607
2607
/* Track PLT entries needed for a given symbol. We might need more
2608
than one glink entry per symbol. */
2608
than one glink entry per symbol when generating a pic binary. */
2609
2609
struct plt_entry
2611
2611
struct plt_entry *next;
2613
2613
/* -fPIC uses multiple GOT sections, one per file, called ".got2".
2614
2614
This field stores the offset into .got2 used to initialise the
2615
GOT pointer reg. It will always be at least 32768 (and for
2616
current gcc this is the only offset used). */
2615
GOT pointer reg. It will always be at least 32768. (Current
2616
gcc always uses an offset of 32768, but ld -r will pack .got2
2617
sections together resulting in larger offsets). */
2617
2618
bfd_vma addend;
2619
2620
/* The .got2 section. */
3408
3409
ppc_elf_howto_init ();
3410
3411
htab = ppc_elf_hash_table (info);
3412
if (htab->glink == NULL)
3414
if (htab->elf.dynobj == NULL)
3415
htab->elf.dynobj = abfd;
3416
if (!ppc_elf_create_glink (htab->elf.dynobj, info))
3411
3419
tga = elf_link_hash_lookup (&htab->elf, "__tls_get_addr",
3412
3420
FALSE, FALSE, TRUE);
3413
3421
symtab_hdr = &elf_symtab_hdr (abfd);
3454
3462
r_type = ELF32_R_TYPE (rel->r_info);
3455
if (!htab->is_vxworks && is_branch_reloc (r_type))
3463
if (!htab->is_vxworks)
3457
if (h != NULL && h == tga)
3460
&& (ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSGD
3461
|| ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSLD))
3462
/* We have a new-style __tls_get_addr call with a marker
3466
/* Mark this section as having an old-style call. */
3467
sec->has_tls_get_addr_call = 1;
3470
/* STT_GNU_IFUNC symbols must have a PLT entry. */
3473
3467
if (h->type == STT_GNU_IFUNC)
3476
ifunc = &h->plt.plist;
3468
ifunc = &h->plt.plist;
3483
3474
if (isym == NULL)
3486
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
3477
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC
3479
|| is_branch_reloc (r_type)))
3488
3483
ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
3490
3485
if (ifunc == NULL)
3498
if (r_type == R_PPC_PLTREL24)
3500
ppc_elf_tdata (abfd)->makes_plt_call = 1;
3501
addend = rel->r_addend;
3503
if (!update_plt_info (abfd, ifunc,
3504
addend < 32768 ? NULL : got2, addend))
3507
if (htab->glink == NULL)
3509
if (htab->elf.dynobj == NULL)
3510
htab->elf.dynobj = abfd;
3511
if (!ppc_elf_create_glink (htab->elf.dynobj, info))
3488
/* STT_GNU_IFUNC symbols must have a PLT entry;
3489
In a non-pie executable even when there are
3492
if (r_type == R_PPC_PLTREL24)
3494
ppc_elf_tdata (abfd)->makes_plt_call = 1;
3496
addend = rel->r_addend;
3498
if (!update_plt_info (abfd, ifunc,
3499
addend < 32768 ? NULL : got2, addend))
3505
if (!htab->is_vxworks
3506
&& is_branch_reloc (r_type)
3511
&& (ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSGD
3512
|| ELF32_R_TYPE (rel[-1].r_info) == R_PPC_TLSLD))
3513
/* We have a new-style __tls_get_addr call with a marker
3517
/* Mark this section as having an old-style call. */
3518
sec->has_tls_get_addr_call = 1;
3517
3521
switch (r_type)
3519
3523
case R_PPC_TLSGD:
3576
3580
/* This is a global offset table entry for a local symbol. */
3577
3581
if (!update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type))
3584
/* We may also need a plt entry if the symbol turns out to be
3586
if (h != NULL && !info->shared)
3588
if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
3581
3593
/* Indirect .sdata relocation. */
3900
3913
/* We may need a plt entry if the symbol turns out to be
3901
3914
a function defined in a dynamic object. */
3902
3915
h->needs_plt = 1;
3904
&& !update_plt_info (abfd, &h->plt.plist, NULL, 0))
3916
if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
4412
4424
r_type = ELF32_R_TYPE (rel->r_info);
4413
if (!htab->is_vxworks && is_branch_reloc (r_type))
4425
if (!htab->is_vxworks
4427
&& local_got_refcounts != NULL
4429
|| is_branch_reloc (r_type)))
4415
struct plt_entry **ifunc = NULL;
4418
if (h->type == STT_GNU_IFUNC)
4419
ifunc = &h->plt.plist;
4421
else if (local_got_refcounts != NULL)
4423
struct plt_entry **local_plt = (struct plt_entry **)
4424
(local_got_refcounts + symtab_hdr->sh_info);
4425
char *local_got_tls_masks = (char *)
4426
(local_plt + symtab_hdr->sh_info);
4427
if ((local_got_tls_masks[r_symndx] & PLT_IFUNC) != 0)
4428
ifunc = local_plt + r_symndx;
4432
bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0;
4433
struct plt_entry *ent = find_plt_ent (ifunc, got2, addend);
4431
struct plt_entry **local_plt = (struct plt_entry **)
4432
(local_got_refcounts + symtab_hdr->sh_info);
4433
char *local_got_tls_masks = (char *)
4434
(local_plt + symtab_hdr->sh_info);
4435
if ((local_got_tls_masks[r_symndx] & PLT_IFUNC) != 0)
4437
struct plt_entry **ifunc = local_plt + r_symndx;
4439
struct plt_entry *ent;
4441
if (r_type == R_PPC_PLTREL24 && info->shared)
4442
addend = rel->r_addend;
4443
ent = find_plt_ent (ifunc, got2, addend);
4434
4444
if (ent->plt.refcount > 0)
4435
4445
ent->plt.refcount -= 1;
4502
4520
case R_PPC_PLT16_HA:
4505
bfd_vma addend = r_type == R_PPC_PLTREL24 ? rel->r_addend : 0;
4506
struct plt_entry *ent = find_plt_ent (&h->plt.plist,
4524
struct plt_entry *ent;
4526
if (r_type == R_PPC_PLTREL24 && info->shared)
4527
addend = rel->r_addend;
4528
ent = find_plt_ent (&h->plt.plist, got2, addend);
4508
4529
if (ent->plt.refcount > 0)
4509
4530
ent->plt.refcount -= 1;
4862
/* After adjust_dynamic_symbol, non_got_ref set means that
4863
dyn_relocs for this symbol should be discarded.
4884
/* After adjust_dynamic_symbol, non_got_ref set in the
4885
non-shared case means that we have allocated space in
4886
.dynbss for the symbol and thus dyn_relocs for this
4887
symbol should be discarded.
4864
4888
If we get here we know we are making a PLT entry for this
4865
4889
symbol, and in an executable we'd normally resolve
4866
4890
relocations against this symbol to the PLT entry. Allow
4868
4892
relocs will not cause text relocation. */
4869
4893
if (!h->ref_regular_nonweak
4870
4894
&& h->non_got_ref
4895
&& h->type != STT_GNU_IFUNC
4871
4896
&& !htab->is_vxworks
4872
4897
&& !ppc_elf_hash_entry (h)->has_sda_refs
4873
4898
&& !readonly_dynrelocs (h))
5105
5130
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
5107
5132
asection *s = htab->plt;
5133
if (!dyn || h->dynindx == -1)
5109
5134
s = htab->iplt;
5111
if (htab->plt_type == PLT_NEW || !dyn)
5136
if (htab->plt_type == PLT_NEW || !dyn || h->dynindx == -1)
5159
5184
/* If this symbol is not defined in a regular
5160
5185
file, and we are not generating a shared
5161
library, then set the symbol to this location
5162
in the .plt. This is required to make
5186
library, then set the symbol to this location
5187
in the .plt. This is to avoid text
5188
relocations, and is required to make
5163
5189
function pointers compare as equal between
5164
5190
the normal executable and the shared library. */
5165
5191
if (! info->shared
5246
5273
/* Make sure this symbol is output as a dynamic symbol. */
5247
5274
if (eh->elf.dynindx == -1
5248
5275
&& !eh->elf.forced_local
5249
&& !eh->elf.def_regular
5276
&& eh->elf.type != STT_GNU_IFUNC
5250
5277
&& htab->elf.dynamic_sections_created)
5252
5279
if (!bfd_elf_link_record_dynamic_symbol (info, &eh->elf))
5286
5313
&& (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
5287
5314
|| eh->elf.root.type != bfd_link_hash_undefweak))
5316
asection *rsec = htab->relgot;
5289
5317
/* All the entries we allocated need relocs.
5290
5318
Except LD only needs one. */
5291
5319
if ((eh->tls_mask & TLS_LD) != 0
5292
5320
&& eh->elf.def_dynamic)
5294
htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
5322
rsec->size += need * (sizeof (Elf32_External_Rela) / 4);
5509
5538
else if (p->count != 0)
5511
elf_section_data (p->sec)->sreloc->size
5512
+= p->count * sizeof (Elf32_External_Rela);
5540
asection *sreloc = elf_section_data (p->sec)->sreloc;
5541
if (!htab->elf.dynamic_sections_created)
5542
sreloc = htab->reliplt;
5543
sreloc->size += p->count * sizeof (Elf32_External_Rela);
5513
5544
if ((p->sec->output_section->flags
5514
5545
& (SEC_READONLY | SEC_ALLOC))
5515
5546
== (SEC_READONLY | SEC_ALLOC))
5827
5858
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
5860
/* Relaxation trampolines. r12 is available for clobbering (r11, is
5861
used for some functions that are allowed to break the ABI). */
5829
5862
static const int shared_stub_entry[] =
5831
5864
0x7c0802a6, /* mflr 0 */
5832
5865
0x429f0005, /* bcl 20, 31, .Lxxx */
5833
0x7d6802a6, /* mflr 11 */
5834
0x3d6b0000, /* addis 11, 11, (xxx-.Lxxx)@ha */
5835
0x396b0018, /* addi 11, 11, (xxx-.Lxxx)@l */
5866
0x7d8802a6, /* mflr 12 */
5867
0x3d8c0000, /* addis 12, 12, (xxx-.Lxxx)@ha */
5868
0x398c0008, /* addi 12, 12, (xxx-.Lxxx)@l */
5836
5869
0x7c0803a6, /* mtlr 0 */
5837
0x7d6903a6, /* mtctr 11 */
5870
0x7d8903a6, /* mtctr 12 */
5838
5871
0x4e800420, /* bctr */
5841
5874
static const int stub_entry[] =
5843
0x3d600000, /* lis 11,xxx@ha */
5844
0x396b0000, /* addi 11,11,xxx@l */
5845
0x7d6903a6, /* mtctr 11 */
5876
0x3d800000, /* lis 12,xxx@ha */
5877
0x398c0000, /* addi 12,12,xxx@l */
5878
0x7d8903a6, /* mtctr 12 */
5846
5879
0x4e800420, /* bctr */
5874
5909
*again = FALSE;
5876
5911
/* Nothing to do if there are no relocations, and no need to do
5877
anything with non-alloc sections. */
5912
anything with non-alloc or non-code sections. */
5878
5913
if ((isec->flags & SEC_ALLOC) == 0
5914
|| (isec->flags & SEC_CODE) == 0
5879
5915
|| (isec->flags & SEC_RELOC) == 0
5880
5916
|| isec->reloc_count == 0)
5905
5941
for (irel = internal_relocs; irel < irelend; irel++)
5907
5943
unsigned long r_type = ELF32_R_TYPE (irel->r_info);
5908
bfd_vma symaddr, reladdr, toff, roff;
5944
bfd_vma reladdr, toff, roff;
5909
5945
asection *tsec;
5910
5946
struct one_fixup *f;
5911
5947
size_t insn_offset = 0;
5912
5948
bfd_vma max_branch_offset, val;
5913
5949
bfd_byte *hit_addr;
5914
5950
unsigned long t0;
5951
struct elf_link_hash_entry *h;
5952
struct plt_entry **plist;
5915
5953
unsigned char sym_type;
5917
5955
switch (r_type)
5975
6013
|| h->root.type == bfd_link_hash_warning)
5976
6014
h = (struct elf_link_hash_entry *) h->root.u.i.link;
5980
if (r_type == R_PPC_PLTREL24
5981
&& htab->plt != NULL)
5983
struct plt_entry *ent = find_plt_ent (&h->plt.plist,
5984
got2, irel->r_addend);
5988
if (htab->plt_type == PLT_NEW)
5991
toff = ent->glink_offset;
5996
toff = ent->plt.offset;
6002
else if (h->root.type == bfd_link_hash_defined
6003
|| h->root.type == bfd_link_hash_defweak)
6016
if (h->root.type == bfd_link_hash_defined
6017
|| h->root.type == bfd_link_hash_defweak)
6005
6019
tsec = h->root.u.def.section;
6006
6020
toff = h->root.u.def.value;
6017
6031
sym_type = h->type;
6034
/* The condition here under which we call find_plt_ent must
6035
match that in relocate_section. If we call find_plt_ent here
6036
but not in relocate_section, or vice versa, then the branch
6037
destination used here may be incorrect. */
6041
/* We know is_branch_reloc (r_type) is true. */
6042
if (h->type == STT_GNU_IFUNC
6043
|| r_type == R_PPC_PLTREL24)
6044
plist = &h->plt.plist;
6046
else if (sym_type == STT_GNU_IFUNC
6047
&& elf_local_got_offsets (abfd) != NULL)
6049
bfd_vma *local_got_offsets = elf_local_got_offsets (abfd);
6050
struct plt_entry **local_plt = (struct plt_entry **)
6051
(local_got_offsets + symtab_hdr->sh_info);
6052
plist = local_plt + ELF32_R_SYM (irel->r_info);
6057
struct plt_entry *ent;
6059
if (r_type == R_PPC_PLTREL24 && link_info->shared)
6060
addend = irel->r_addend;
6061
ent = find_plt_ent (plist, got2, addend);
6064
if (htab->plt_type == PLT_NEW
6066
|| !htab->elf.dynamic_sections_created
6067
|| h->dynindx == -1)
6070
toff = ent->glink_offset;
6075
toff = ent->plt.offset;
6020
6080
/* If the branch and target are in the same section, you have
6021
6081
no hope of adding stubs. We'll error out later should the
6022
6082
branch overflow. */
6074
6132
&& (!link_info->relocatable
6075
6133
/* A relocatable link may have sections moved during
6076
6134
final link, so do not presume they remain in range. */
6077
|| tsec->output_section == isec->output_section)
6078
&& symaddr - reladdr + max_branch_offset < 2 * max_branch_offset)
6135
|| tsec->output_section == isec->output_section))
6137
bfd_vma symaddr, reladdr;
6139
symaddr = tsec->output_section->vma + tsec->output_offset + toff;
6140
reladdr = isec->output_section->vma + isec->output_offset + roff;
6141
if (symaddr - reladdr + max_branch_offset < 2 * max_branch_offset)
6081
6145
/* Look for an existing fixup to this address. */
6082
6146
for (f = fixups; f ; f = f->next)
6915
if (!htab->is_vxworks && is_branch_reloc (r_type))
6979
if (!htab->is_vxworks)
6981
struct plt_entry *ent;
6919
6985
if (h->type == STT_GNU_IFUNC)
6920
6986
ifunc = &h->plt.plist;
6922
else if (local_got_offsets != NULL)
6924
if (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
6926
struct plt_entry **local_plt = (struct plt_entry **)
6927
(local_got_offsets + symtab_hdr->sh_info);
6929
ifunc = local_plt + r_symndx;
6934
struct plt_entry *ent = find_plt_ent (ifunc, got2, rel->r_addend);
6988
else if (local_got_offsets != NULL
6989
&& ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
6991
struct plt_entry **local_plt;
6993
local_plt = (struct plt_entry **) (local_got_offsets
6994
+ symtab_hdr->sh_info);
6995
ifunc = local_plt + r_symndx;
7001
|| is_branch_reloc (r_type)))
7004
if (r_type == R_PPC_PLTREL24 && info->shared)
7005
addend = rel->r_addend;
7006
ent = find_plt_ent (ifunc, got2, addend);
6936
7010
if (h == NULL && (ent->plt.offset & 1) == 0)
6938
7012
Elf_Internal_Rela rela;
6943
7017
+ ent->plt.offset);
6944
7018
rela.r_info = ELF32_R_INFO (0, R_PPC_IRELATIVE);
6945
7019
rela.r_addend = relocation;
6946
loc = (htab->reliplt->contents
6947
+ ent->plt.offset * sizeof (Elf32_External_Rela) / 4);
7020
loc = htab->reliplt->contents;
7021
loc += (htab->reliplt->reloc_count++
7022
* sizeof (Elf32_External_Rela));
6948
7023
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
6950
7025
ent->plt.offset |= 1;
7125
7200
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
7126
7201
|| h->root.type != bfd_link_hash_undefweak))
7203
asection *rsec = htab->relgot;
7128
7205
outrel.r_offset = (htab->got->output_section->vma
7129
7206
+ htab->got->output_offset
7134
7211
outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPMOD32);
7135
7212
if (tls_ty == (TLS_TLS | TLS_GD))
7137
loc = htab->relgot->contents;
7138
loc += (htab->relgot->reloc_count++
7214
loc = rsec->contents;
7215
loc += (rsec->reloc_count++
7139
7216
* sizeof (Elf32_External_Rela));
7140
7217
bfd_elf32_swap_reloca_out (output_bfd,
7148
7225
outrel.r_info = ELF32_R_INFO (indx, R_PPC_DTPREL32);
7149
7226
else if (tls_ty == (TLS_TLS | TLS_TPREL))
7150
7227
outrel.r_info = ELF32_R_INFO (indx, R_PPC_TPREL32);
7152
outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
7229
outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
7230
else if (ifunc != NULL)
7231
outrel.r_info = ELF32_R_INFO (0, R_PPC_IRELATIVE);
7154
outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
7233
outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
7155
7234
if (indx == 0 && tls_ty != (TLS_TLS | TLS_LD))
7157
7236
outrel.r_addend += relocation;
7158
7237
if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL))
7159
7238
outrel.r_addend -= htab->elf.tls_sec->vma;
7161
loc = htab->relgot->contents;
7162
loc += (htab->relgot->reloc_count++
7240
loc = rsec->contents;
7241
loc += (rsec->reloc_count++
7163
7242
* sizeof (Elf32_External_Rela));
7164
7243
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
7367
7446
if (sreloc == NULL)
7369
sreloc = _bfd_elf_get_dynamic_reloc_section
7370
(input_bfd, input_section, /*rela?*/ TRUE);
7448
sreloc = elf_section_data (input_section)->sreloc;
7449
if (!htab->elf.dynamic_sections_created)
7450
sreloc = htab->reliplt;
7371
7451
if (sreloc == NULL)
7398
7478
outrel.r_addend = relocation + rel->r_addend;
7400
if (r_type == R_PPC_ADDR32)
7401
outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
7480
if (r_type != R_PPC_ADDR32)
7406
if (r_symndx == 0 || bfd_is_abs_section (sec))
7486
/* If we get here when building a static
7487
executable, then the libc startup function
7488
responsible for applying indirect function
7489
relocations is going to complain about
7491
If we get here when building a dynamic
7492
executable, it will be because we have
7493
a text relocation. The dynamic loader
7494
will set the text segment writable and
7495
non-executable to apply text relocations.
7496
So we'll segfault when trying to run the
7497
indirection function to resolve the reloc. */
7498
(*_bfd_error_handler)
7499
(_("%B(%A+0x%lx): relocation %s for indirect "
7500
"function %s unsupported"),
7503
(long) rel->r_offset,
7508
else if (r_symndx == 0 || bfd_is_abs_section (sec))
7408
7510
else if (sec == NULL || sec->owner == NULL)
7418
7520
against a section symbol. It would be
7419
7521
proper to subtract the symbol's value,
7420
7522
osec->vma, from the emitted reloc addend,
7421
but ld.so expects buggy relocs. */
7523
but ld.so expects buggy relocs.
7524
FIXME: Why not always use a zero index? */
7422
7525
osec = sec->output_section;
7423
7526
indx = elf_section_data (osec)->dynindx;
7438
7541
outrel.r_info = ELF32_R_INFO (indx, r_type);
7543
else if (ifunc != NULL)
7544
outrel.r_info = ELF32_R_INFO (0, R_PPC_IRELATIVE);
7546
outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
7442
7549
loc = sreloc->contents;
7462
7569
case R_PPC_RELAX32PC_PLT:
7463
7570
case R_PPC_RELAX32_PLT:
7465
struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2, addend);
7467
if (htab->plt_type == PLT_NEW)
7468
relocation = (htab->glink->output_section->vma
7469
+ htab->glink->output_offset
7470
+ ent->glink_offset);
7472
relocation = (htab->plt->output_section->vma
7473
+ htab->plt->output_offset
7573
struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
7574
info->shared ? addend : 0);
7575
if (htab->plt_type == PLT_NEW)
7576
relocation = (htab->glink->output_section->vma
7577
+ htab->glink->output_offset
7578
+ ent->glink_offset);
7580
relocation = (htab->plt->output_section->vma
7581
+ htab->plt->output_offset
7476
7584
if (r_type == R_PPC_RELAX32_PLT)
7478
7586
/* Fall thru */
7556
7664
/* Relocation is to the entry for this symbol in the
7557
7665
procedure linkage table. */
7559
struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2, addend);
7667
struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
7668
info->shared ? addend : 0);
7562
7670
if (ent == NULL
7563
7671
|| htab->plt == NULL)
7905
8014
/* This symbol has an entry in the procedure linkage table.
7907
8016
if (htab->plt_type == PLT_VXWORKS
7908
&& htab->elf.dynamic_sections_created)
8017
&& htab->elf.dynamic_sections_created
8018
&& h->dynindx != -1)
7910
8020
bfd_vma got_offset;
7911
8021
const bfd_vma *plt_entry;
8030
8140
asection *splt = htab->plt;
8031
if (!htab->elf.dynamic_sections_created)
8141
if (!htab->elf.dynamic_sections_created
8142
|| h->dynindx == -1)
8032
8143
splt = htab->iplt;
8034
8145
rela.r_offset = (splt->output_section->vma
8035
8146
+ splt->output_offset
8036
8147
+ ent->plt.offset);
8037
8148
if (htab->plt_type == PLT_OLD
8038
|| !htab->elf.dynamic_sections_created)
8149
|| !htab->elf.dynamic_sections_created
8150
|| h->dynindx == -1)
8040
8152
/* We don't need to fill in the .plt. The ppc dynamic
8041
8153
linker will fill it in. */
8066
8178
rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_JMP_SLOT);
8068
if (!htab->elf.dynamic_sections_created)
8069
loc = htab->reliplt->contents;
8180
if (!htab->elf.dynamic_sections_created
8181
|| h->dynindx == -1)
8182
loc = (htab->reliplt->contents
8183
+ (htab->reliplt->reloc_count++
8184
* sizeof (Elf32_External_Rela)));
8071
loc = htab->relplt->contents;
8072
loc += reloc_index * sizeof (Elf32_External_Rela);
8186
loc = (htab->relplt->contents
8187
+ reloc_index * sizeof (Elf32_External_Rela));
8073
8188
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
8075
8190
if (!h->def_regular)
8092
8207
sym->st_value = 0;
8210
else if (h->type == STT_GNU_IFUNC
8213
/* Set the value of ifunc symbols in a non-pie
8214
executable to the glink entry. This is to avoid
8215
text relocations. We can't do this for ifunc in
8216
allocate_dynrelocs, as we do for normal dynamic
8217
function symbols with plt entries, because we need
8218
to keep the original value around for the ifunc
8220
sym->st_shndx = (_bfd_elf_section_from_bfd_section
8221
(output_bfd, htab->glink->output_section));
8222
sym->st_value = (ent->glink_offset +
8223
htab->glink->output_offset
8224
+ htab->glink->output_section->vma);
8095
8226
doneone = TRUE;
8098
8229
if (htab->plt_type == PLT_NEW
8099
|| !htab->elf.dynamic_sections_created)
8230
|| !htab->elf.dynamic_sections_created
8231
|| h->dynindx == -1)
8101
8233
asection *splt = htab->plt;
8102
if (!htab->elf.dynamic_sections_created)
8234
if (!htab->elf.dynamic_sections_created
8235
|| h->dynindx == -1)
8103
8236
splt = htab->iplt;
8105
8238
write_glink_stub (ent, splt, info);
8107
if (!info->shared && !info->pie)
8108
8241
/* We only need one non-PIC glink stub. */