Adds support to the RL78 port for linker relaxation affecting .debug sections.

gas	* config/tc-rl78.h (TC_LINKRELAX_FIXUP): Define.
	(TC_FORCE_RELOCATION_SUB_SAME): Define.
	(DWARF2_USE_FIXED_ADVANCE_PC): Define.

	* gas/lns/lns.exp: Add RL78 to list of targets using
	DW_LNS_fixed_advance_pc.

bfd	* elf32-rl78.c (RL78_OP_REL): New macro.
	(rl78_elf_howto_table): Use it for complex relocs.
	(get_symbol_value): Handle the cases when the info or status
	arguments are NULL.
	(get_romstart): Cache the status returned by get_symbol_value.
	(get_ramstart): Likewise.
	(RL78_STACK_PUSH): Generate an error message if the stack
	overflows.
	(RL78_STACK_POP): Likewise for underflows.
	(rl78_compute_complex_reloc): New function.  Contains the basic
	processing code for all RL78 complex relocs.
	(rl78_special_reloc): New function.  Provides special reloc
	handling for complex relocs.
	(rl78_elf_relocate_section): Use rl78_compute_complex_reloc.
	(rl78_offset_for_reloc): Likewise.

binutils* readelf.c (target_specific_reloc_handling): Add code to handle
	RL78 complex relocs.
This commit is contained in:
Nick Clifton
2015-04-14 16:23:33 +01:00
parent 9e811bc379
commit 6ff71e7681
9 changed files with 582 additions and 427 deletions

View File

@@ -11161,6 +11161,42 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc,
}
break;
}
case EM_RL78:
{
static bfd_vma saved_sym1 = 0;
static bfd_vma saved_sym2 = 0;
static bfd_vma value;
switch (reloc_type)
{
case 0x80: /* R_RL78_SYM. */
saved_sym1 = saved_sym2;
saved_sym2 = symtab[get_reloc_symindex (reloc->r_info)].st_value;
saved_sym2 += reloc->r_addend;
return TRUE;
case 0x83: /* R_RL78_OPsub. */
value = saved_sym1 - saved_sym2;
saved_sym2 = saved_sym1 = 0;
return TRUE;
break;
case 0x41: /* R_RL78_ABS32. */
byte_put (start + reloc->r_offset, value, 4);
value = 0;
return TRUE;
case 0x43: /* R_RL78_ABS16. */
byte_put (start + reloc->r_offset, value, 2);
value = 0;
return TRUE;
default:
break;
}
break;
}
}
return FALSE;