From: Alexandre Oliva Date: Tue, 8 May 2007 06:09:30 +0000 (+0000) Subject: * elf32-frv.c (elf32_frv_relocate_section): Discard dynamic relocs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0d4cc89286c02f6945e60dc09ed321c7ca880775;p=binutils-gdb.git * elf32-frv.c (elf32_frv_relocate_section): Discard dynamic relocs for which _bfd_elf_section_offset returns -1. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b6941555ec7..60d9d647aff 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2007-05-08 Alexandre Oliva + + * elf32-frv.c (elf32_frv_relocate_section): Discard dynamic relocs + for which _bfd_elf_section_offset returns -1. + 2007-05-08 Alan Modra * elf32-spu.c (spu_elf_size_stubs): Use "void *" for psyms. diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 3f0a173242a..742f7d36516 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -3644,6 +3644,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { + bfd_vma offset; + if (_frvfdpic_osec_readonly_p (output_bfd, input_section ->output_section)) @@ -3654,22 +3656,27 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, name, input_bfd, input_section, rel->r_offset); return FALSE; } - _frvfdpic_add_rofixup (output_bfd, - frvfdpic_gotfixup_section - (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section - ->output_section->vma - + input_section->output_offset, - picrel); + + offset = _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset); + + if (offset != (bfd_vma)-1) + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section + (info), + offset + input_section + ->output_section->vma + + input_section->output_offset, + picrel); } } else if ((bfd_get_section_flags (output_bfd, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { + bfd_vma offset; + if (_frvfdpic_osec_readonly_p (output_bfd, input_section ->output_section)) @@ -3680,15 +3687,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, name, input_bfd, input_section, rel->r_offset); return FALSE; } - _frvfdpic_add_dyn_reloc (output_bfd, - frvfdpic_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section - ->output_section->vma - + input_section->output_offset, - r_type, dynindx, addend, picrel); + + offset = _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset); + + if (offset != (bfd_vma)-1) + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + offset + input_section + ->output_section->vma + + input_section->output_offset, + r_type, dynindx, addend, picrel); } else addend += frvfdpic_got_section (info)->output_section->vma; @@ -3769,25 +3779,27 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, } if (!h || h->root.type != bfd_link_hash_undefweak) { - _frvfdpic_add_rofixup (output_bfd, - frvfdpic_gotfixup_section - (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section - ->output_section->vma - + input_section->output_offset, - picrel); - if (r_type == R_FRV_FUNCDESC_VALUE) - _frvfdpic_add_rofixup - (output_bfd, - frvfdpic_gotfixup_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section->output_section->vma - + input_section->output_offset + 4, picrel); + bfd_vma offset = _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset); + + if (offset != (bfd_vma)-1) + { + _frvfdpic_add_rofixup (output_bfd, + frvfdpic_gotfixup_section + (info), + offset + input_section + ->output_section->vma + + input_section->output_offset, + picrel); + if (r_type == R_FRV_FUNCDESC_VALUE) + _frvfdpic_add_rofixup + (output_bfd, + frvfdpic_gotfixup_section (info), + offset + + input_section->output_section->vma + + input_section->output_offset + 4, picrel); + } } } } @@ -3797,6 +3809,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { + bfd_vma offset; + if (_frvfdpic_osec_readonly_p (output_bfd, input_section ->output_section)) @@ -3807,15 +3821,18 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, name, input_bfd, input_section, rel->r_offset); return FALSE; } - _frvfdpic_add_dyn_reloc (output_bfd, - frvfdpic_gotrel_section (info), - _bfd_elf_section_offset - (output_bfd, info, - input_section, rel->r_offset) - + input_section - ->output_section->vma - + input_section->output_offset, - r_type, dynindx, addend, picrel); + + offset = _bfd_elf_section_offset + (output_bfd, info, + input_section, rel->r_offset); + + if (offset != (bfd_vma)-1) + _frvfdpic_add_dyn_reloc (output_bfd, + frvfdpic_gotrel_section (info), + offset + input_section + ->output_section->vma + + input_section->output_offset, + r_type, dynindx, addend, picrel); } else if (osec) addend += osec->output_section->vma;