This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Reuse of reloc_howto_type depending on section
- From: Martin Walter <martin dot walter at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sun, 26 Jul 2009 23:58:16 +0200
- Subject: Reuse of reloc_howto_type depending on section
Hello!
I am currently porting the Binutils to a new architecture and ask for
your help in the following issue: The target architecture requires all
addresses to the instruction memory (in control transfer instructions)
to be multiples of 2 (since all instructions are 16 bits wide and
properly aligned), whereas the data memory can be accessed on a per
byte basis. Now, the assembler allows for functions lo(), hi(), 3rd(),
4th() within load instructions to extract portions of a symbol, and
these are used to access both the instruction memory and the data
memory.
What I would like to do is to let relocations be right shifted by an
additional 1 if the symbol within lo(), hi(), etc. refers to the .text
section. Currently, all symbols are right shifted by this amount in
the relocation process (but this is a failure for symbols referring to
the data memory).
Here is an example of the reloc_howto_type for hi():
/* A second byte absolute relocation of 32-bit address. */
HOWTO (R_SPEAR32_HI, /* type */
9, /* rightshift */
0, /* size (0 = byte, 1 =
short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
4, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_SPEAR32_HI", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xFF0, /* dst_mask */
FALSE), /* pcrel_offset */
Any clues on that issue? Thanks in advance!
Martin