diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2009-03-24 07:57:21 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2009-03-24 07:57:21 +0000 |
commit | 6718f446dafc31e82d1010c272ccb1310a02a1fb (patch) | |
tree | c8af3f28c3a895b222a56091376a47f9495c3ae1 | |
parent | a3224241d37815406e23b8043a3d0a3df9e00c1c (diff) | |
download | gdb-6718f446dafc31e82d1010c272ccb1310a02a1fb.zip gdb-6718f446dafc31e82d1010c272ccb1310a02a1fb.tar.gz gdb-6718f446dafc31e82d1010c272ccb1310a02a1fb.tar.bz2 |
* 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.
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elf32-cris.c | 29 |
2 files changed, 31 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8336ac4..ea96f89 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,13 @@ 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> <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. diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 6dc669a..ed1f3e8 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -1615,10 +1615,12 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_CRIS_16_DTPREL: case R_CRIS_32_DTPREL: /* This relocation must only be performed against local - symbols. It's also ok when we link a program and the - symbol is defined in an ordinary (non-DSO) object (if - it's undefined there, we've already seen an error). */ + symbols, or to sections that are not loadable. It's also + ok when we link a program and the symbol is defined in an + ordinary (non-DSO) object (if it's undefined there, we've + already seen an error). */ if (h != NULL + && (input_section->flags & SEC_ALLOC) != 0 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT && (info->shared || (!h->def_regular @@ -1641,14 +1643,16 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, 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 already done so. Note that we do this in .got.plt, not in .got, as .got.plt contains the first part, still the reloc is against .got, because the linker script directs (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"); BFD_ASSERT (sgotplt != NULL); @@ -2684,6 +2688,10 @@ cris_elf_gc_sweep_hook (bfd *abfd, break; 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: elf_cris_hash_table (info)->dtpmod_refcount--; 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. */ switch (r_type) { - case R_CRIS_16_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 entry at index 3. */ if (elf_cris_hash_table (info)->dtpmod_refcount == 0) |