Reuse of reloc_howto_type depending on section

Nick Clifton nickc@redhat.com
Tue Jul 28 12:14:00 GMT 2009


Hi Martin,

>     case SPEAR32_OPERAND_SIMM8:
>       fixP->fx_pcrel = 0;
> 
>       if (fixP->fx_cgen.opinfo != 0)
>         type = fixP->fx_cgen.opinfo;

But at this point you also have access to fixP->fx_add_symbol.  So you 
can transform the basic relocation type that you are extracting from 
fixP->fx_cgen.opinfo.  eg:

      if (fixP->fx_cgen.opinfo != 0)
        {
          type = fixP->fx_cgen.opinfo;
          if (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_CODE)
            type += 1;
        }

(I have assumed here that you have arranged for the ..._TEXT versions of 
the relocs to have a numerical value of 1 more than their corresponding 
data address space versions).

Cheers
   Nick



More information about the Binutils mailing list