Commit: RL78: Fix handling of immediate values in complex relocs

Nick Clifton nickc@redhat.com
Fri Jul 24 15:42:00 GMT 2015


Hi Guys,

  The RL78 target uses complex relocs to achieve various different
  effects.  As part of their operation these relocs use an evaluation
  stack to hold temporary values.  Unfortunately it turns out that it is
  not possible to push an immediate value onto this evaluation stack
  because the code in bfd_perform_relocation() and
  bfd_install_relocation() prevent it.  They processes any relocs
  against the absolute section symbol immediately rather than passing
  them to the special relocation handler function (if it exists).

  The attached patch fixes this problem by creating a new RL78 specific
  absolute symbol and changing any immediate value in a complex
  relocation sequence to be against this new symbol.  This avoids
  changing the generic code in bfd/reloc.c, but unfortunately means that
  the new symbol has to be PROVIDED by rl78 linker scripts.  This in
  turn means that a few tests have to be tweaked to allow for this new
  symbol.

  Tested with no regressions on an rl78-elf toolchain.

Cheers
  Nick

gas/ChangeLog
2015-07-24  Nick Clifton  <nickc@redhat.com>

	* 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/ChangeLog
2015-07-24  Nick Clifton  <nickc@redhat.com>

	* emulparams/elf32rl78.sh (OTHER_SECTIONS): Provide a value for
	the _-rl78_abs__ symbol.

gas/testsuite/ChangeLog
2015-07-24  Nick Clifton  <nickc@redhat.com>

	* 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.

binutils/testsuite/ChangeLog
2015-07-24  Nick Clifton  <nickc@redhat.com>

	* binutils-all/localize-hidden-1.d: Allow for extra symbols in the
	output.
        * binutils-all/strip-11.d: Skip for the RL78.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rl78.abs.sym.patch
Type: text/x-patch
Size: 4760 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150724/4b8c6aa8/attachment.bin>


More information about the Binutils mailing list