This is the mail archive of the binutils@sourceware.org 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: what's the intention of "bfd_elf32_bfd_get_relocated_section_contents" in bfd sources


Thanks.
   I found following two call sequences:
1  bfd_elf_final_link
     ->  _bfd_default_link_order
           ->  default_indirect_link_order
                 ->  bfd_get_relocated_section_contents

2  _bfd_generic_final_link
     ->  default_indirect_link_order
           ->  bfd_get_relocated_section_contents

and in Elfxx-target.h there is

#ifdef elf_backend_relocate_section
#define bfd_elfNN_bfd_final_link	bfd_elf_final_link
#else
#define bfd_elfNN_bfd_final_link	_bfd_generic_final_link
#endif

Now it is clear that function "bfd_get_relocated_section_contents" is
basically a generic linker interface used if without target-specific
ones, although it is still used in this elf-specific ones.

Since "bfd_get_relocated_section_contents" will eventually calls to
bfd_perform_relocation, I have to modify "bfd_perform_relocation" If I
want to add new relocation types into instruction set.

This is kinda awful because I thought "bfd_perform_relocation" is just
a default function substitute by target-specific ones.

the conclusion is BFD is such a complicate thing for me....
Thanks again.

On Wed, Dec 24, 2008 at 5:59 PM, Andreas Schwab <schwab@suse.de> wrote:
> Amker.Cheng <amker.cheng@gmail.com> writes:
>
>>     And I found no codes in binutils uses the
>> macro("bfd_elf32_bfd_get_relocated_section_contents"),
>
> It is called via bfd_get_relocated_section_contents, which is used by
> the generic linker (bfd/linker.c) and is also used by objdump and gdb
> (via bfd_simple_get_relocated_section_contents).
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>


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