Reuse of reloc_howto_type depending on section

Martin Walter martin.walter@gmail.com
Tue Jul 28 22:23:00 GMT 2009
2009/7/28 Nick Clifton <nickc@redhat.com>:
> 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).

Hi Nick,

I just tried your idea, however I experienced the following problem:
undefined symbols, such, as an example, 'main' in crt0 cannot be
covered by this approach, since they are not within the scope of the
assembler. Can you think of some way to get this done by the linker?

Cheers,
Martin



More information about the Binutils mailing list