rl78: relaxation fixes
authorDJ Delorie <dj@redhat.com>
Tue, 8 Dec 2015 06:29:25 +0000 (01:29 -0500)
committerDJ Delorie <dj@redhat.com>
Tue, 8 Dec 2015 06:29:25 +0000 (01:29 -0500)
commite896287c1643b8b47080c4a8ddbe9a92d9fa585b
treecbab9e88d6c15d508f6498f7050089895fa9e5e3
parent7859afc4fa05f6876c4e6b95cfb8fc252efd96bc
rl78: relaxation fixes

Various fixes to linker relaxation.  In general, we need to support
relaxing every branch, even if we don't relax it in the assembler,
so we can optionally defer relaxation to the linker.

* elf32-rl78.c (rl78_offset_for_reloc): Add more relocs.
(rl78_elf_relax_section): Add bc/bz/bnc/bnz/bh/bnh.  Fix reloc
choices.

* config/rl78-parse.y: Make all branches relaxable via
rl78_linkrelax_branch().
* config/tc-rl78.c (rl78_linkrelax_branch): Mark all relaxable
branches with relocs.
(options): Add OPTION_NORELAX.
(md_longopts): Add -mnorelax.
(md_parse_option): Support OPTION_NORELAX.
(op_type_T): Add bh, sk, call, and br.
(rl78_opcode_type): Likewise.
(rl78_relax_frag): Fix not-relaxing logic.  Add sk.
(md_convert_frag): Fix relocation handling.
(tc_gen_reloc): Strip relax relocs when not linker relaxing.
(md_apply_fix): Defer overflow handling for anything that needs a
PLT, to the linker.
* config/tc-rl78.h (TC_FORCE_RELOCATION): Force all relocations to
the linker when linker relaxing.
* doc/c-rl78.texi (norelax): Add.
bfd/ChangeLog
bfd/elf32-rl78.c
gas/ChangeLog
gas/config/rl78-parse.y
gas/config/tc-rl78.c
gas/config/tc-rl78.h
gas/doc/c-rl78.texi