Gold linker - help with .reginfo section for mips

Ian Lance Taylor iant@google.com
Wed May 11 15:23:00 GMT 2011


Aleksandar Simeonov <Aleksandar.Simeonov@RT-RK.com> writes:

> After few tries and errors I decided to write you again. I still have
> problems with .reginfo section. I managed to find all data I need, but I
> still have problems to set them in output section. I did create new
> type, but still have problems to set correct output data (as well as
> correct size). Any idea how to set output data and size in
> Output_section class would be great since I'm stuck with this for a week
> already.

It's a little hard to answer a general question like that.

The way for an Output_section class to set the size is to provide its
own implementation of the set_final_data_size method.  It should call
set_data_size with the final size.  For .reginfo the size is a constant,
so this is easy.

The way to write out the data is to provide its own implementation of
the do_write method.  It should write out the data.

Hope that helps.

Ian

> On 26/04/2011 18:51, Ian Lance Taylor wrote:
>
>>> 3. MIPS has .reginfo section. It contains list of registers that are
>>> used in current file as well as value of _gp. It is always 24 bytes long
>>> (4 bytes for general purpose registers, 16 bytes for coprocessors'
>>> registers and 4 bytes for global pointer value). Currently, Gold just
>>> concatenates .reginfo sections from all input files. What has to be done
>>> is following: first 20 bytes of every section is combined using OR
>>> operation, and last 4 bytes just get value of _gp. I'm trying to make
>>> that some how, but I have problems to find data I need (I have idea
>>> where to find input data, but still I haven't managed to get access to
>>> it). Also, I'm not sure if I implement that on correct place (in
>>> Target_mips<size, big_endian>::do_finalize_sections function)?
>> 
>> I think the right way to handle this is for the MIPS target to override
>> the default do_make_output_section method.  For a SHT_MIPS_REGINFO
>> section it should return a new kind of output section, as the ARM target
>> does.  That new class should do the right thing in the various virtual
>> functions such as set_final_data_size() and write().
>> 
>> Ian
>> 



More information about the Binutils mailing list