Reuse of reloc_howto_type depending on section

Nick Clifton nickc@redhat.com
Thu Jul 30 15:27:00 GMT 2009


Hi Martin,

> My idea: instead of returning types BFD_RELOC_X and BFD_RELOC_X_CODE
> in spear32_cgen_lookup_reloc() I would stick to returning
> BFD_RELOC_Xs, since this approach does not cover undefined symbols in
> the assembler suitably. I would then like to implement the division by
> 2 in spear32_final_link_relocate() just before calling
> bfd_final_link_relocate().

This makes sense.

> However, I am unsure how to determine the
> section of the symbol in spear32_final_link_relocate().

Have a look at how it is done for other targets.  For example in 
bfd/elf-m10300.c:mn10300_elf_relocate_section (which calls 
mn10300_elf_final_link_relocate) there is code to compute the value for 
a variable called 'sec' which is the section containing the symbol that 
is referred to by the reloc.  You can then test the flags field of this 
structure to determine if the section is a code section.

Cheers
   Nick




More information about the Binutils mailing list