This is the mail archive of the 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]

Initial MIPS patch for GOLD - version 3

Hi Ian,
Please find patch for MIPS version of Gold. It still contains just
initial version of code for MIPS, but this time I added all changes that
are done in common code. Since those changes have effects on all
architectures I would like to ask you to check if you approve them, and
if not, to give some suggestions how to change them.

List of changes in common code:
* (Parameters::entry) : Default entry symbol for MIPS is
- Unlike other architectures, default entry symbol for MIPS is "__start",
not "_start".

* (Output_file_header::entry) : Start address is not defaulting
to zero but rather to starting address of .text section (if exists).
* target.h (Target::text_section_address) : New function.
- If there are no start symbol or start address is not set from command
line, MIPS linker has to set start of .text section, not 0 (if section

* output.h (Output_data_reloc::add_absolute_null) : New function. Needed
for generation of R_MIPS_NONE relocation.
* (Output_reloc::compare) :  R_MIPS_NONE relocation have to be
- First dynamic relocation in MIPS executable or shared object has to be
null relocation (absolute R_MIPS_NONE type to address 0). Function for
creating that entry is added and there were changes in function for
sorting dynamic relocations in order to have this relocation first.

* symtab.h (Symbol::set_nonvis) : New function. Set the non-visibility
part of the st_other field.
- Needed to set STO_MIPS_PLT flag that represents undefined functions (in
file) that are PLT entries.

* (Layout::finalize) : Added additional fixing of section data
after all necessary information are known (for MIPS data about dynamic
symbol table are needed).
* target.h (Target::fix_sections) : New function.
* target.h (Target::do_fix_sections) : New function.
- If there are more then 65536 entries in dynamic symbol table entries in
.MIPS.stubs section have size of 5 32-bit words (4 32-bits words is size
when there are less or equal then 65536 entries). Since this value is only
known at the end of Layout::finalize function, additional fixing of data
is needed at the end of that function.

* (got_offset_compare) : New function.
* (Symbol_table::set_dynsym_indexes) : Order of symbols in
dynamic symbol table changed. New order is local symbols, global symbols
without got entry, global symbols with got entry.
- MIPS has strict order of entries in dynamic symbol table. First come
local symbols, then global symbols that has no entry in got, then global
symbols that has got entry.

* symtab.h (Symbol_table::global_got_index_): New data member.
* symtab.h (Symbol_table::global_got_index): New function.
- First entry in dynamic symbol table that has got entry. Needed for
.dynamic section tag (DT_MIPS_GOTSYM).

* utils.h: New file that contains utilities for manipulating integers of
up to 32-bits.
* (namespace utils): Removed common code to separate file (utils.h).
* (utils::sign_extend): Removed.
* (utils::has_overflow): Likewise.
* (utils::has_signed_unsigned_overflow): Likewise.
* (utils::bit_select): Likewise.
- Functions that are common for MIPS and ARM architectures moved to
separate file to avoid duplication of code.

* (Output_data_dynamic::Dynamic_entry::write): Added code for
target specific dynamic tags.
* output.h (Output_data_dynamic::add_target_specific): Added function for
adding target specific dynamic tag.
* output.h (Output_data_dynamic::add_target_specific): New method.
* output.h (Output_data_dynamic::Dynamic_entry): Add support for target
specific dynamic table entries.
* output.h (DYNAMIC_TARGET): New enum for target specific dynamic tags.
- MIPS has several dynamic tags that are mandatory. This code is added to
support them.

* (Layout::segment_precedes): Fixed order of MIPS specific
- MIPS needs to have PT_MIPS_REGINFO segment before any loadable segment.
- MIPS needs to have PT_NULL segment to be last in list of segments.

* layout.h (Layout::segment_list): Returns segment list.
* layout.h (Layout::segment_list): New function.
- MIPS dynamic tag DT_MIPS_BASE_ADDRESS needs virtual address of first
loadable segment.

* (Sized_relobj_file<size, big_endian>::write_sections): Special
handling of MIPS .reginfo section.
- .reginfo section is generated by linker and needs special handling.

Rest of the changes are or in mips specific part or in make and configure
files (new target is added).

Best regards,

Attachment: mips_gold.tar.gz
Description: application/gzip

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