Gold linker - help with .reginfo section for mips

Ian Lance Taylor iant@google.com
Wed May 11 17:32:00 GMT 2011


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

> 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();
> }

If you only need special treatment for SHT_MIPS_REGINFO, then I would
recommend only creating a Mips_output_section for SHT_MIPS_REGINFO.  It
should probably be named Mips_reginfo_section or something like that.
For other section types just return a regular Output_section, probably
by simply calling this->Target::do_make_output_section.

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

You can't override set_final_data_size without also overriding do_write.
Look at, e.g., Output_compress_section for an example of an
Output_section which is not the simple concatenation of input sections.

Ian



More information about the Binutils mailing list