mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
* elf32-cris.c (cris_elf_relocate_section): <case
R_CRIS_16_DTPREL, R_CRIS_32_DTPREL>: Allow use of non-local symbols for non-allocated sections. Don't check whether to generate R_CRIS_DTPMOD for non-allocated sections. (cris_elf_gc_sweep_hook) <case R_CRIS_32_DTPREL>: Don't handle relocation GC:ing if applied to non-allocated section. (cris_elf_check_relocs): Similar.
This commit is contained in:
@ -1,5 +1,13 @@
|
|||||||
2009-03-24 Hans-Peter Nilsson <hp@axis.com>
|
2009-03-24 Hans-Peter Nilsson <hp@axis.com>
|
||||||
|
|
||||||
|
* elf32-cris.c (cris_elf_relocate_section): <case
|
||||||
|
R_CRIS_16_DTPREL, R_CRIS_32_DTPREL>: Allow use of non-local
|
||||||
|
symbols for non-allocated sections. Don't check whether to
|
||||||
|
generate R_CRIS_DTPMOD for non-allocated sections.
|
||||||
|
(cris_elf_gc_sweep_hook) <case R_CRIS_32_DTPREL>: Don't
|
||||||
|
handle relocation GC:ing if applied to non-allocated section.
|
||||||
|
(cris_elf_check_relocs): Similar.
|
||||||
|
|
||||||
* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GD>
|
* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_GD>
|
||||||
<R_CRIS_16_GOT_GD, R_CRIS_32_GOT_GD>: Don't include the TLS size
|
<R_CRIS_16_GOT_GD, R_CRIS_32_GOT_GD>: Don't include the TLS size
|
||||||
when emitting a known TP offset in the GOT.
|
when emitting a known TP offset in the GOT.
|
||||||
|
@ -1615,10 +1615,12 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
|||||||
case R_CRIS_16_DTPREL:
|
case R_CRIS_16_DTPREL:
|
||||||
case R_CRIS_32_DTPREL:
|
case R_CRIS_32_DTPREL:
|
||||||
/* This relocation must only be performed against local
|
/* This relocation must only be performed against local
|
||||||
symbols. It's also ok when we link a program and the
|
symbols, or to sections that are not loadable. It's also
|
||||||
symbol is defined in an ordinary (non-DSO) object (if
|
ok when we link a program and the symbol is defined in an
|
||||||
it's undefined there, we've already seen an error). */
|
ordinary (non-DSO) object (if it's undefined there, we've
|
||||||
|
already seen an error). */
|
||||||
if (h != NULL
|
if (h != NULL
|
||||||
|
&& (input_section->flags & SEC_ALLOC) != 0
|
||||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||||
&& (info->shared
|
&& (info->shared
|
||||||
|| (!h->def_regular
|
|| (!h->def_regular
|
||||||
@ -1641,14 +1643,16 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BFD_ASSERT (elf_cris_hash_table (info)->dtpmod_refcount != 0);
|
BFD_ASSERT ((input_section->flags & SEC_ALLOC) == 0
|
||||||
|
|| elf_cris_hash_table (info)->dtpmod_refcount != 0);
|
||||||
|
|
||||||
/* Fill in a R_CRIS_DTPMOD reloc at offset 3 if we haven't
|
/* Fill in a R_CRIS_DTPMOD reloc at offset 3 if we haven't
|
||||||
already done so. Note that we do this in .got.plt, not
|
already done so. Note that we do this in .got.plt, not
|
||||||
in .got, as .got.plt contains the first part, still the
|
in .got, as .got.plt contains the first part, still the
|
||||||
reloc is against .got, because the linker script directs
|
reloc is against .got, because the linker script directs
|
||||||
(is required to direct) them both into .got. */
|
(is required to direct) them both into .got. */
|
||||||
if (elf_cris_hash_table (info)->dtpmod_refcount > 0)
|
if (elf_cris_hash_table (info)->dtpmod_refcount > 0
|
||||||
|
&& (input_section->flags & SEC_ALLOC) != 0)
|
||||||
{
|
{
|
||||||
asection *sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
asection *sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
BFD_ASSERT (sgotplt != NULL);
|
BFD_ASSERT (sgotplt != NULL);
|
||||||
@ -2684,6 +2688,10 @@ cris_elf_gc_sweep_hook (bfd *abfd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R_CRIS_32_DTPREL:
|
case R_CRIS_32_DTPREL:
|
||||||
|
/* This'd be a .dtpreld entry in e.g. debug info. */
|
||||||
|
if ((sec->flags & SEC_ALLOC) == 0)
|
||||||
|
break;
|
||||||
|
/* Fall through. */
|
||||||
case R_CRIS_16_DTPREL:
|
case R_CRIS_16_DTPREL:
|
||||||
elf_cris_hash_table (info)->dtpmod_refcount--;
|
elf_cris_hash_table (info)->dtpmod_refcount--;
|
||||||
if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
|
if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
|
||||||
@ -3151,8 +3159,17 @@ cris_elf_check_relocs (abfd, info, sec, relocs)
|
|||||||
on the first input bfd we found that contained dynamic relocs. */
|
on the first input bfd we found that contained dynamic relocs. */
|
||||||
switch (r_type)
|
switch (r_type)
|
||||||
{
|
{
|
||||||
case R_CRIS_16_DTPREL:
|
|
||||||
case R_CRIS_32_DTPREL:
|
case R_CRIS_32_DTPREL:
|
||||||
|
if ((sec->flags & SEC_ALLOC) == 0)
|
||||||
|
/* This'd be a .dtpreld entry in e.g. debug info. We have
|
||||||
|
several different switch statements below, but none of
|
||||||
|
that is needed; we need no preparations for resolving
|
||||||
|
R_CRIS_32_DTPREL into a non-allocated section (debug
|
||||||
|
info), so let's just move on to the next
|
||||||
|
relocation. */
|
||||||
|
continue;
|
||||||
|
/* Fall through. */
|
||||||
|
case R_CRIS_16_DTPREL:
|
||||||
/* The first .got.plt entry is right after the R_CRIS_DTPMOD
|
/* The first .got.plt entry is right after the R_CRIS_DTPMOD
|
||||||
entry at index 3. */
|
entry at index 3. */
|
||||||
if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
|
if (elf_cris_hash_table (info)->dtpmod_refcount == 0)
|
||||||
|
Reference in New Issue
Block a user