aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-rl78.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-07-24 16:44:27 +0100
committerNick Clifton <nickc@redhat.com>2015-07-24 16:44:27 +0100
commitaff1a65ecb5cfcf1abfb23ea0e0f37f39e75683e (patch)
tree06e40b920daf39a9f55075b40106bb2d074ba362 /gas/config/tc-rl78.c
parent5826e159863b6cd69953dc01faf7c20414409909 (diff)
downloadgdb-aff1a65ecb5cfcf1abfb23ea0e0f37f39e75683e.zip
gdb-aff1a65ecb5cfcf1abfb23ea0e0f37f39e75683e.tar.gz
gdb-aff1a65ecb5cfcf1abfb23ea0e0f37f39e75683e.tar.bz2
Fix the evaluation of RL78 complex relocs, by making immediate values be computed relative to a new absolute symbol.
gas * config/tc-rl78.c (rl78_abs_sym): New local variable. (md_begin): Initialise the new symbol. (OPIMM): Define the value to be relative to the new symbol and not the absolute section symbol. ld * emulparams/elf32rl78.sh (OTHER_SECTIONS): Provide a value for the _-rl78_abs__ symbol. tests * gas/all/struct.d: Allow for extra symbols in the output. * gas/macros/test1.d: Likewise. * gas/elf/elf.exp: Add an rl78 machine. * gas/elf/sections2e-rl78: New file. tests * binutils-all/localize-hidden-1.d: Allow for extra symbols in the output. * binutils-all/strip-11.d: Skip for the RL78.
Diffstat (limited to 'gas/config/tc-rl78.c')
-rw-r--r--gas/config/tc-rl78.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c
index 3a14fc0..c9d5c97 100644
--- a/gas/config/tc-rl78.c
+++ b/gas/config/tc-rl78.c
@@ -402,9 +402,12 @@ const pseudo_typeS md_pseudo_table[] =
{ NULL, NULL, 0 }
};
+static symbolS * rl78_abs_sym = NULL;
+
void
md_begin (void)
{
+ rl78_abs_sym = symbol_make ("__rl78_abs__");
}
void
@@ -1240,7 +1243,17 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
reloc[rp]->address = fixp->fx_frag->fr_address + fixp->fx_where; \
reloc[++rp] = NULL
#define OPSYM(SYM) OPX(BFD_RELOC_RL78_SYM, SYM, 0)
-#define OPIMM(IMM) OPX(BFD_RELOC_RL78_SYM, abs_symbol.bsym, IMM)
+
+ /* FIXME: We cannot do the normal thing for an immediate value reloc,
+ ie creating a RL78_SYM reloc in the *ABS* section with an offset
+ equal to the immediate value we want to store. This fails because
+ the reloc processing in bfd_perform_relocation and bfd_install_relocation
+ will short circuit such relocs and never pass them on to the special
+ reloc processing code. So instead we create a RL78_SYM reloc against
+ the __rl78_abs__ symbol and arrange for the linker scripts to place
+ this symbol at address 0. */
+#define OPIMM(IMM) OPX (BFD_RELOC_RL78_SYM, symbol_get_bfdsym (rl78_abs_sym), IMM)
+
#define OP(OP) OPX(BFD_RELOC_RL78_##OP, *reloc[0]->sym_ptr_ptr, 0)
#define SYM0() reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RL78_SYM)