Hi Nick,
This patch is to fix R_M32R_10_PCREL_RELA linkage bug.
When I changed type REL of relocation to RELA, it was not enough
to care for R_M32R_10_PCREL_RELA.
Please commit it.
Regards,
Kazuhiro Inaoka
EC No. H05-0044
------------------------------------------------------------------------
bfd/ChangeLog
2005-11-22 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
* elf32-m32r.c (m32r_elf_relocate_section): Fix
R_M32R_10_PCREL_RELA linkage bug.
* elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
Index: elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.75
diff -p -u -r1.75 elf32-m32r.c
--- elf32-m32r.c 25 Oct 2005 16:19:06 -0000 1.75
+++ elf32-m32r.c 21 Nov 2005 07:24:02 -0000
@@ -2878,6 +2878,7 @@ m32r_elf_relocate_section (bfd *output_b
case R_M32R_24_RELA:
case R_M32R_32_RELA:
case R_M32R_REL32:
+ case R_M32R_10_PCREL_RELA:
case R_M32R_18_PCREL_RELA:
case R_M32R_26_PCREL_RELA:
case R_M32R_HI16_ULO_RELA:
@@ -2887,6 +2888,7 @@ m32r_elf_relocate_section (bfd *output_b
&& (input_section->flags & SEC_ALLOC) != 0
&& ((r_type != R_M32R_18_PCREL_RELA
&& r_type != R_M32R_26_PCREL_RELA
+ && r_type != R_M32R_10_PCREL_RELA
&& r_type != R_M32R_REL32)
|| (h != NULL
&& h->dynindx != -1
@@ -2938,6 +2940,7 @@ m32r_elf_relocate_section (bfd *output_b
memset (&outrel, 0, sizeof outrel);
else if (r_type == R_M32R_18_PCREL_RELA
|| r_type == R_M32R_26_PCREL_RELA
+ || r_type == R_M32R_10_PCREL_RELA
|| r_type == R_M32R_REL32)
{
BFD_ASSERT (h != NULL && h->dynindx != -1);
@@ -2975,8 +2978,10 @@ m32r_elf_relocate_section (bfd *output_b
an addend for the dynamic reloc. */
if (! relocate)
continue;
+ break;
}
- break;
+ else if (r_type != R_M32R_10_PCREL_RELA)
+ break;
case (int) R_M32R_10_PCREL :
r = m32r_elf_do_10_pcrel_reloc (input_bfd, howto, input_section,
@@ -3714,6 +3719,7 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIB
case R_M32R_HI16_SLO_RELA:
case R_M32R_LO16_RELA:
case R_M32R_SDA16_RELA:
+ case R_M32R_10_PCREL_RELA:
case R_M32R_18_PCREL_RELA:
case R_M32R_26_PCREL_RELA:
if (h != NULL)
@@ -3732,6 +3738,7 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIB
{
if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
|| ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
+ || ELF32_R_TYPE (rel->r_info) == R_M32R_10_PCREL_RELA
|| ELF32_R_TYPE (rel->r_info) == R_M32R_REL32)
p->pc_count -= 1;
p->count -= 1;
@@ -3897,6 +3904,7 @@ m32r_elf_check_relocs (bfd *abfd,
case R_M32R_HI16_SLO_RELA:
case R_M32R_LO16_RELA:
case R_M32R_SDA16_RELA:
+ case R_M32R_10_PCREL_RELA:
case R_M32R_18_PCREL_RELA:
case R_M32R_26_PCREL_RELA:
@@ -3929,6 +3937,7 @@ m32r_elf_check_relocs (bfd *abfd,
&& (sec->flags & SEC_ALLOC) != 0
&& ((r_type != R_M32R_26_PCREL_RELA
&& r_type != R_M32R_18_PCREL_RELA
+ && r_type != R_M32R_10_PCREL_RELA
&& r_type != R_M32R_REL32)
|| (h != NULL
&& (! info->symbolic
@@ -4020,6 +4029,7 @@ m32r_elf_check_relocs (bfd *abfd,
p->count += 1;
if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
|| ELF32_R_TYPE (rel->r_info) == R_M32R_REL32
+ || ELF32_R_TYPE (rel->r_info) == R_M32R_10_PCREL_RELA
|| ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA)
p->pc_count += 1;
}