&& eh->has_addr16_lo
&& htab->params->pic_fixup > 0))
{
- unsigned int need;
-
/* Make sure this symbol is output as a dynamic symbol. */
if (!ensure_undef_dynamic (info, &eh->elf))
return false;
- need = 0;
+ unsigned int need = got_entries_needed (eh->tls_mask);
+ unsigned int rel_need = need * sizeof (Elf32_External_Rela) / 4;
if ((eh->tls_mask & (TLS_TLS | TLS_LD)) == (TLS_TLS | TLS_LD))
{
if (SYMBOL_REFERENCES_LOCAL (info, &eh->elf))
a local dynamic reloc against a non-local symbol. */
htab->tlsld_got.refcount += 1;
else
- need += 8;
+ {
+ need += 8;
+ rel_need += sizeof (Elf32_External_Rela);
+ }
}
- need += got_entries_needed (eh->tls_mask);
if (need == 0)
eh->elf.got.offset = (bfd_vma) -1;
else
{
asection *rsec;
- need *= sizeof (Elf32_External_Rela) / 4;
- if ((eh->tls_mask & (TLS_TLS | TLS_LD)) == (TLS_TLS | TLS_LD))
- need -= sizeof (Elf32_External_Rela);
rsec = htab->elf.srelgot;
if (eh->elf.type == STT_GNU_IFUNC)
rsec = htab->elf.irelplt;
- rsec->size += need;
+ rsec->size += rel_need;
}
}
}
--- /dev/null
+#as: -a32
+#ld: -shared -melf32ppc
+#readelf: -rW
+
+Relocation section '\.rela\.dyn' at offset .* contains 3 entries:
+ Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
+.* +00000044 R_PPC_DTPMOD32 +0
+.* +0000004e R_PPC_DTPREL32 +0
+.* +00000044 R_PPC_DTPMOD32 +0
+
+Relocation section '\.rela\.plt' at offset .* contains 1 entry:
+ Offset +Info +Type +Sym\. Value +Symbol's Name \+ Addend
+.* +00000215 R_PPC_JMP_SLOT +00000000 +__tls_get_addr \+ 0
--- /dev/null
+#PR 30697
+ .section ".tbss","awT",@nobits
+ .global _start,x
+ .hidden x
+ .align 2
+x: .space 4
+
+ .text
+_start:
+ addi 3,30,x@got@tlsgd
+ bl __tls_get_addr(x@tlsgd)@plt
+
+ addi 3,30,x@got@tlsld
+ bl __tls_get_addr(x@tlsld)@plt
+ addis 3,3,x@dtprel@ha
+ addi 3,3,x@dtprel@l