This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Gold linker - help with .reginfo section for mips
- From: Ian Lance Taylor <iant at google dot com>
- To: Aleksandar Simeonov <Aleksandar dot Simeonov at RT-RK dot com>
- Cc: rich at mips dot com, binutils at sourceware dot org
- Date: Wed, 11 May 2011 08:22:54 -0700
- Subject: Re: Gold linker - help with .reginfo section for mips
- References: <4DB6F193.5090302@RT-RK.com> <mcrpqo9klaw.fsf@google.com> <4DCAA6E4.9080100@RT-RK.com>
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
>>