This is the mail archive of the
mailing list for the binutils project.
Re: Reuse of reloc_howto_type depending on section
Martin Walter wrote:
> 2009/7/27 Dave Korn <firstname.lastname@example.org>:
>> Martin Walter wrote:
>>> 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).
>> 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. ?
> 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
But you don't do it in the parse section anyway. Since you're using cgen,
relocs are generated in md_cgen_lookup_reloc(), where you have access to the
underlying fixS struct.