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: Gold linker - help with .reginfo section for mips


Here is code I added for set_final_data_size:
template <int size, bool big_endian>
void Mips_output_section <size, big_endian>::set_final_data_size()
{
  if (this->type () == elfcpp::SHT_MIPS_REGINFO)
    {
      this->set_data_size(24);
    }
  else
    Output_section::set_final_data_size();
}

But now I have error as follows:
./mips-linux-gnu-ld.gold: internal error in write_sections, at reloc.cc:816

I guess something is missing?

Aleksandar
On 11/05/2011 17:22, Ian Lance Taylor wrote:
> 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
>>>
> 


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