This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reuse of reloc_howto_type depending on section

2009/7/27 Dave Korn <>:
> 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

Hi DaveK,

I also thought about this solution, but the parse function of the
assembler has signature
(CGEN_CPU_DESC cd, const char **strp, int opindex, long *valuep) and
therefore does not include any information about the section of the

By the way, to anyone who reads this, I do not rely on reusing the
reloc_howto_type, any solution would be great!

Thank you,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]