summaryrefslogtreecommitdiff
path: root/bfd/elf32-cris.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2009-03-24 07:57:21 +0000
committerHans-Peter Nilsson <hp@axis.com>2009-03-24 07:57:21 +0000
commitee0acf361bb8f4b9ecd5d967b00bbda5d64a8264 (patch)
treee248c9ad90c0655a63164f7c2a3874588b847ae0 /bfd/elf32-cris.c
parentd9f933887735787be18a367020f43dafffe83a23 (diff)
downloadbinutils-redhat-ee0acf361bb8f4b9ecd5d967b00bbda5d64a8264.tar.gz
* 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.
Diffstat (limited to 'bfd/elf32-cris.c')
-rw-r--r--bfd/elf32-cris.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 6dc669a493..ed1f3e8d50 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)