.text & text.hot section for bfd ?

Nick Clifton nickc@redhat.com
Mon Feb 6 17:16:00 GMT 2006


Hi Sandeep,

> If we use the callback get_section_by_name provided by bfd and try to
> pass the ".text" section as a parameter .
> Will it also include the text.hot section and text.unlikely by default
> into the .text.

No.

 > Or  will have to write three callbacks for each of them.

Yes.

Or in fact you will probably want to search for all sections whose name 
starts with .text. and process all of those.

> If so, then how do we determine that which executables have and which dont.

Use the function bfd_map_over_sections to search through all of the 
sections in a BFD.  Check the names (or attributes) of each section 
against your desired search parameters.

> I am working on dynamic optimization system, Where we start our
> interpretation from the main, which is generally present in the .text
> section. But, Suppose for the code of gcc, it has a text.hot and call
> to main()  lies in this section,

Starting from main is generally a bad idea.  Almost no executable really 
starts at main.  You should start from the entry point for the 
executable and scan from there.

Cheers
   Nick




More information about the Binutils mailing list