forked from pool/binutils
205 lines
6.5 KiB
Diff
205 lines
6.5 KiB
Diff
2008-11-20 Alan Modra <amodra@bigpond.net.au>
|
|
|
|
* elf32-ppc.c (allocate_dynrelocs): Always use tlsld_got for
|
|
TLS_LD even when symbol is used with other TLS reloc types.
|
|
(ppc_elf_relocate_section): Bypass symbol checks when using tlsld_got.
|
|
Leave addend zero on LD DTPMOD dynamic reloc.
|
|
|
|
2008-11-17 Eric B. Weddington <eric.weddington@atmel.com>
|
|
|
|
PR 7022
|
|
* elf32-avr.c (bfd_elf_avr_final_write_processing):
|
|
Add missing break statements.
|
|
|
|
ld/:
|
|
2008-11-14 Alan Modra <amodra@bigpond.net.au>
|
|
|
|
* Makefile.am (spu_ovl.o_c): Add missing line continuations.
|
|
* Makefile.in: Regenerate.
|
|
|
|
--- bfd/elf32-avr.c
|
|
+++ bfd/elf32-avr.c
|
|
@@ -1298,6 +1298,7 @@ bfd_elf_avr_final_write_processing (bfd *abfd,
|
|
|
|
case bfd_mach_avr25:
|
|
val = E_AVR_MACH_AVR25;
|
|
+ break;
|
|
|
|
case bfd_mach_avr3:
|
|
val = E_AVR_MACH_AVR3;
|
|
@@ -1305,9 +1306,11 @@ bfd_elf_avr_final_write_processing (bfd *abfd,
|
|
|
|
case bfd_mach_avr31:
|
|
val = E_AVR_MACH_AVR31;
|
|
+ break;
|
|
|
|
case bfd_mach_avr35:
|
|
val = E_AVR_MACH_AVR35;
|
|
+ break;
|
|
|
|
case bfd_mach_avr4:
|
|
val = E_AVR_MACH_AVR4;
|
|
--- bfd/elf32-ppc.c
|
|
+++ bfd/elf32-ppc.c
|
|
@@ -4997,6 +4997,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
|
eh = (struct ppc_elf_link_hash_entry *) h;
|
|
if (eh->elf.got.refcount > 0)
|
|
{
|
|
+ bfd_boolean dyn;
|
|
+ unsigned int need;
|
|
+
|
|
/* Make sure this symbol is output as a dynamic symbol. */
|
|
if (eh->elf.dynindx == -1
|
|
&& !eh->elf.forced_local
|
|
@@ -5006,30 +5009,32 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
|
return FALSE;
|
|
}
|
|
|
|
- if (eh->tls_mask == (TLS_TLS | TLS_LD)
|
|
- && !eh->elf.def_dynamic)
|
|
- {
|
|
- /* If just an LD reloc, we'll just use htab->tlsld_got.offset. */
|
|
- htab->tlsld_got.refcount += 1;
|
|
- eh->elf.got.offset = (bfd_vma) -1;
|
|
- }
|
|
- else
|
|
+ need = 0;
|
|
+ if ((eh->tls_mask & TLS_TLS) != 0)
|
|
{
|
|
- bfd_boolean dyn;
|
|
- unsigned int need = 0;
|
|
- if ((eh->tls_mask & TLS_TLS) != 0)
|
|
+ if ((eh->tls_mask & TLS_LD) != 0)
|
|
{
|
|
- if ((eh->tls_mask & TLS_LD) != 0)
|
|
- need += 8;
|
|
- if ((eh->tls_mask & TLS_GD) != 0)
|
|
+ if (!eh->elf.def_dynamic)
|
|
+ /* We'll just use htab->tlsld_got.offset. This should
|
|
+ always be the case. It's a little odd if we have
|
|
+ a local dynamic reloc against a non-local symbol. */
|
|
+ htab->tlsld_got.refcount += 1;
|
|
+ else
|
|
need += 8;
|
|
- if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
|
|
- need += 4;
|
|
- if ((eh->tls_mask & TLS_DTPREL) != 0)
|
|
- need += 4;
|
|
}
|
|
- else
|
|
+ if ((eh->tls_mask & TLS_GD) != 0)
|
|
+ need += 8;
|
|
+ if ((eh->tls_mask & (TLS_TPREL | TLS_TPRELGD)) != 0)
|
|
+ need += 4;
|
|
+ if ((eh->tls_mask & TLS_DTPREL) != 0)
|
|
need += 4;
|
|
+ }
|
|
+ else
|
|
+ need += 4;
|
|
+ if (need == 0)
|
|
+ eh->elf.got.offset = (bfd_vma) -1;
|
|
+ else
|
|
+ {
|
|
eh->elf.got.offset = allocate_got (htab, need);
|
|
dyn = htab->elf.dynamic_sections_created;
|
|
if ((info->shared
|
|
@@ -5039,7 +5044,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
|
{
|
|
/* All the entries we allocated need relocs.
|
|
Except LD only needs one. */
|
|
- if ((eh->tls_mask & TLS_LD) != 0)
|
|
+ if ((eh->tls_mask & TLS_LD) != 0
|
|
+ && eh->elf.def_dynamic)
|
|
need -= 4;
|
|
htab->relgot->size += need * (sizeof (Elf32_External_Rela) / 4);
|
|
}
|
|
@@ -5275,27 +5281,24 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|
for (; local_got < end_local_got; ++local_got, ++lgot_masks)
|
|
if (*local_got > 0)
|
|
{
|
|
- if (*lgot_masks == (TLS_TLS | TLS_LD))
|
|
+ unsigned int need = 0;
|
|
+ if ((*lgot_masks & TLS_TLS) != 0)
|
|
{
|
|
- /* If just an LD reloc, we'll just use
|
|
- htab->tlsld_got.offset. */
|
|
- htab->tlsld_got.refcount += 1;
|
|
- *local_got = (bfd_vma) -1;
|
|
+ if ((*lgot_masks & TLS_GD) != 0)
|
|
+ need += 8;
|
|
+ if ((*lgot_masks & TLS_LD) != 0)
|
|
+ htab->tlsld_got.refcount += 1;
|
|
+ if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
|
|
+ need += 4;
|
|
+ if ((*lgot_masks & TLS_DTPREL) != 0)
|
|
+ need += 4;
|
|
}
|
|
else
|
|
+ need += 4;
|
|
+ if (need == 0)
|
|
+ *local_got = (bfd_vma) -1;
|
|
+ else
|
|
{
|
|
- unsigned int need = 0;
|
|
- if ((*lgot_masks & TLS_TLS) != 0)
|
|
- {
|
|
- if ((*lgot_masks & TLS_GD) != 0)
|
|
- need += 8;
|
|
- if ((*lgot_masks & (TLS_TPREL | TLS_TPRELGD)) != 0)
|
|
- need += 4;
|
|
- if ((*lgot_masks & TLS_DTPREL) != 0)
|
|
- need += 4;
|
|
- }
|
|
- else
|
|
- need += 4;
|
|
*local_got = allocate_got (htab, need);
|
|
if (info->shared)
|
|
htab->relgot->size += (need
|
|
@@ -6560,7 +6563,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
|
|
|
/* Generate relocs for the dynamic linker. */
|
|
if ((info->shared || indx != 0)
|
|
- && (h == NULL
|
|
+ && (offp == &htab->tlsld_got.offset
|
|
+ || h == NULL
|
|
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
|
|| h->root.type != bfd_link_hash_undefweak))
|
|
{
|
|
@@ -6591,7 +6595,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
|
outrel.r_info = ELF32_R_INFO (indx, R_PPC_RELATIVE);
|
|
else
|
|
outrel.r_info = ELF32_R_INFO (indx, R_PPC_GLOB_DAT);
|
|
- if (indx == 0)
|
|
+ if (indx == 0 && tls_ty != (TLS_TLS | TLS_LD))
|
|
{
|
|
outrel.r_addend += relocation;
|
|
if (tls_ty & (TLS_GD | TLS_DTPREL | TLS_TPREL))
|
|
--- ld/Makefile.am
|
|
+++ ld/Makefile.am
|
|
@@ -758,9 +758,9 @@ eelf32_spu.c: $(srcdir)/emulparams/elf32_spu.sh $(srcdir)/emultempl/spuelf.em \
|
|
$(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S
|
|
if ../gas/as-new --version \
|
|
| grep 'target.*spu' >/dev/null 2>/dev/null; then \
|
|
- cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s
|
|
+ cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \
|
|
../gas/as-new -o spu_ovl.o spu_ovl.s; \
|
|
- ../binutils/bin2c <spu_ovl.o >$@
|
|
+ ../binutils/bin2c <spu_ovl.o >$@; \
|
|
fi
|
|
eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
|
|
$(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
|
--- ld/Makefile.in
|
|
+++ ld/Makefile.in
|
|
@@ -1588,9 +1588,9 @@ eelf32_spu.c: $(srcdir)/emulparams/elf32_spu.sh $(srcdir)/emultempl/spuelf.em \
|
|
$(srcdir)/emultempl/spu_ovl.o_c: @MAINT@ $(srcdir)/emultempl/spu_ovl.S
|
|
if ../gas/as-new --version \
|
|
| grep 'target.*spu' >/dev/null 2>/dev/null; then \
|
|
- cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s
|
|
+ cpp -DOVLY_IRQ_SAVE $(srcdir)/emultempl/spu_ovl.S spu_ovl.s; \
|
|
../gas/as-new -o spu_ovl.o spu_ovl.s; \
|
|
- ../binutils/bin2c <spu_ovl.o >$@
|
|
+ ../binutils/bin2c <spu_ovl.o >$@; \
|
|
fi
|
|
eelf32_i860.c: $(srcdir)/emulparams/elf32_i860.sh \
|
|
$(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|