This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Reuse of reloc_howto_type depending on section
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Martin Walter <martin dot walter at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 27 Jul 2009 13:55:08 +0100
- Subject: Re: Reuse of reloc_howto_type depending on section
- References: <c55980430907261458i2d5dc937jfdc734aefbc82d9f@mail.gmail.com>
Martin Walter wrote:
> 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).
> /* A second byte absolute relocation of 32-bit address. */
> HOWTO (R_SPEAR32_HI, /* type */
> 9, /* rightshift */
Would it be simplest to define two different relocations, R_SPEAR32_HI and
R_SPEAR32_HI_TEXT for example, that use different rightshift values, and take
care to emit the correct one according to the symbol section in the assembler
when parsing the lo()/hi()/etc. ?
cheers,
DaveK