case R_SH_SWITCH32:
/* These relocs types represent
.word L2-L1
- The r_offset field holds the difference between the reloc
+ The r_addend field holds the difference between the reloc
address and L1. That is the start of the reloc, and
adding in the contents gives us the top. We must adjust
- both the r_offset field and the section contents. */
+ both the r_offset field and the section contents.
+ N.B. in gas / coff bfd, the elf bfd r_addend is called r_offset,
+ and the elf bfd r_offset is called r_vaddr. */
- start = irel->r_offset;
- stop = (bfd_vma) ((bfd_signed_vma) start - (long) irel->r_addend);
+ stop = irel->r_offset;
+ start = (bfd_vma) ((bfd_signed_vma) stop - (long) irel->r_addend);
if (start > addr
&& start < toaddr
&& (start <= addr || start >= toaddr))
irel->r_addend -= count;
- start = stop;
-
if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH16)
voff = bfd_get_signed_16 (abfd, contents + nraddr);
else if (ELF32_R_TYPE (irel->r_info) == (int) R_SH_SWITCH8)
{
Elf_Internal_Sym sym;
+ /* Dwarf line numbers use R_SH_SWITCH32 relocs. */
+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_SH_SWITCH32)
+ {
+ bfd_vma start, stop;
+ bfd_signed_vma voff;
+
+ if (ocontents == NULL)
+ {
+ if (elf_section_data (o)->this_hdr.contents != NULL)
+ ocontents = elf_section_data (o)->this_hdr.contents;
+ else
+ {
+ /* We always cache the section contents.
+ Perhaps, if info->keep_memory is false, we
+ should free them, if we are permitted to,
+ when we leave sh_coff_relax_section. */
+ ocontents = (bfd_byte *) bfd_malloc (o->_raw_size);
+ if (ocontents == NULL)
+ return false;
+ if (! bfd_get_section_contents (abfd, o, ocontents,
+ (file_ptr) 0,
+ o->_raw_size))
+ return false;
+ elf_section_data (o)->this_hdr.contents = ocontents;
+ }
+ }
+
+ stop = irelscan->r_offset;
+ start
+ = (bfd_vma) ((bfd_signed_vma) stop - (long) irelscan->r_addend);
+
+ /* STOP is in a different section, so it won't change. */
+ if (start > addr && start < toaddr)
+ irelscan->r_addend += count;
+
+ voff = bfd_get_signed_32 (abfd, ocontents + irelscan->r_offset);
+ stop = (bfd_vma) ((bfd_signed_vma) start + voff);
+
+ if (start > addr
+ && start < toaddr
+ && (stop <= addr || stop >= toaddr))
+ bfd_put_signed_32 (abfd, voff + count,
+ ocontents + irelscan->r_offset);
+ else if (stop > addr
+ && stop < toaddr
+ && (start <= addr || start >= toaddr))
+ bfd_put_signed_32 (abfd, voff - count,
+ ocontents + irelscan->r_offset);
+ }
+
if (ELF32_R_TYPE (irelscan->r_info) != (int) R_SH_DIR32)
continue;
#define elf_backend_relocate_section sh_elf_relocate_section
#define bfd_elf32_bfd_get_relocated_section_contents \
sh_elf_get_relocated_section_contents
+#define bfd_elf32_bfd_merge_private_bfd_data \
+ _bfd_generic_verify_endian_match
#define elf_backend_gc_mark_hook sh_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook sh_elf_gc_sweep_hook