GNU Binutils with patches for OS216
Révision | 01b84e25533166047340c41a33cc29153e536227 (tree) |
---|---|
l'heure | 2016-03-19 06:54:35 |
Auteur | Vladimir Radosavljevic <vladimir.radosavljevic@imgt...> |
Commiter | Cary Coutant |
Remove is_n64_ data member from Mips_relobj class.
elfcpp/
* mips.h (abi_64): Remove.
gold/
* mips.cc (Mips_relobj::is_n64_): Remove.
(Target_mips::ei_class_): Likewise.
(Mips_relobj::is_newabi): Call methods.
(Mips_relobj::is_n64): Change checking for N64 ABI.
(Target_mips::is_output_n64): Likewise.
(Target_mips::merge_processor_specific_flags): Remove ei_class
argument, and remove comparing ei_class.
(Target_mips::do_adjust_elf_header): Remove setting EI_CLASS field
of the ELF header.
(Target_mips::do_finalize_sections): Don't pass ei_class argument
to merge_processor_specific_flags.
(Target_mips::elf_mips_abi_name): Remove ei_class argument, and
change checking for N64 ABI.
@@ -1,3 +1,7 @@ | ||
1 | +2016-03-18 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com> | |
2 | + | |
3 | + * mips.h (abi_64): Remove. | |
4 | + | |
1 | 5 | 2016-01-12 H.J. Lu <hongjiu.lu@intel.com> |
2 | 6 | |
3 | 7 | * elfcpp_internal.h (Mips64_rel_data, Mips64_rela_data): Remove |
@@ -339,11 +339,6 @@ bool | ||
339 | 339 | abi_n32(elfcpp::Elf_Word e_flags) |
340 | 340 | { return (e_flags & elfcpp::EF_MIPS_ABI2) != 0; } |
341 | 341 | |
342 | -// Whether the ABI is N64. | |
343 | -bool | |
344 | -abi_64(unsigned char ei_class) | |
345 | -{ return ei_class == elfcpp::ELFCLASS64; } | |
346 | - | |
347 | 342 | // Whether the file has microMIPS code. |
348 | 343 | bool |
349 | 344 | is_micromips(elfcpp::Elf_Word e_flags) |
@@ -1,3 +1,19 @@ | ||
1 | +2016-03-18 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com> | |
2 | + | |
3 | + * mips.cc (Mips_relobj::is_n64_): Remove. | |
4 | + (Target_mips::ei_class_): Likewise. | |
5 | + (Mips_relobj::is_newabi): Call methods. | |
6 | + (Mips_relobj::is_n64): Change checking for N64 ABI. | |
7 | + (Target_mips::is_output_n64): Likewise. | |
8 | + (Target_mips::merge_processor_specific_flags): Remove ei_class | |
9 | + argument, and remove comparing ei_class. | |
10 | + (Target_mips::do_adjust_elf_header): Remove setting EI_CLASS field | |
11 | + of the ELF header. | |
12 | + (Target_mips::do_finalize_sections): Don't pass ei_class argument | |
13 | + to merge_processor_specific_flags. | |
14 | + (Target_mips::elf_mips_abi_name): Remove ei_class argument, and | |
15 | + change checking for N64 ABI. | |
16 | + | |
1 | 17 | 2016-03-17 Vladimir Radosavljevic <vladimir.radosavljevic@imgtec.com> |
2 | 18 | |
3 | 19 | * mips.cc (enum Special_relocation_symbol): New enum type. |
@@ -1537,7 +1537,6 @@ class Mips_relobj : public Sized_relobj_file<size, big_endian> | ||
1537 | 1537 | { |
1538 | 1538 | this->is_pic_ = (ehdr.get_e_flags() & elfcpp::EF_MIPS_PIC) != 0; |
1539 | 1539 | this->is_n32_ = elfcpp::abi_n32(ehdr.get_e_flags()); |
1540 | - this->is_n64_ = elfcpp::abi_64(ehdr.get_e_ident()[elfcpp::EI_CLASS]); | |
1541 | 1540 | } |
1542 | 1541 | |
1543 | 1542 | ~Mips_relobj() |
@@ -1694,12 +1693,12 @@ class Mips_relobj : public Sized_relobj_file<size, big_endian> | ||
1694 | 1693 | // Return whether the object uses N64 ABI. |
1695 | 1694 | bool |
1696 | 1695 | is_n64() const |
1697 | - { return this->is_n64_; } | |
1696 | + { return size == 64; } | |
1698 | 1697 | |
1699 | 1698 | // Return whether the object uses NewABI conventions. |
1700 | 1699 | bool |
1701 | 1700 | is_newabi() const |
1702 | - { return this->is_n32_ || this->is_n64_; } | |
1701 | + { return this->is_n32() || this->is_n64(); } | |
1703 | 1702 | |
1704 | 1703 | // Return Mips_got_info for this object. |
1705 | 1704 | Mips_got_info<size, big_endian>* |
@@ -1848,8 +1847,6 @@ class Mips_relobj : public Sized_relobj_file<size, big_endian> | ||
1848 | 1847 | bool is_pic_ : 1; |
1849 | 1848 | // Whether the object uses N32 ABI. |
1850 | 1849 | bool is_n32_ : 1; |
1851 | - // Whether the object uses N64 ABI. | |
1852 | - bool is_n64_ : 1; | |
1853 | 1850 | // The Mips_got_info for this object. |
1854 | 1851 | Mips_got_info<size, big_endian>* got_info_; |
1855 | 1852 |
@@ -3202,8 +3199,8 @@ class Target_mips : public Sized_target<size, big_endian> | ||
3202 | 3199 | : Sized_target<size, big_endian>(info), got_(NULL), gp_(NULL), plt_(NULL), |
3203 | 3200 | got_plt_(NULL), rel_dyn_(NULL), copy_relocs_(), |
3204 | 3201 | dyn_relocs_(), la25_stub_(NULL), mips_mach_extensions_(), |
3205 | - mips_stubs_(NULL), ei_class_(0), mach_(0), layout_(NULL), | |
3206 | - got16_addends_(), entry_symbol_is_compressed_(false), insn32_(false) | |
3202 | + mips_stubs_(NULL), mach_(0), layout_(NULL), got16_addends_(), | |
3203 | + entry_symbol_is_compressed_(false), insn32_(false) | |
3207 | 3204 | { |
3208 | 3205 | this->add_machine_extensions(); |
3209 | 3206 | } |
@@ -3485,14 +3482,10 @@ class Target_mips : public Sized_target<size, big_endian> | ||
3485 | 3482 | return elfcpp::abi_n32(this->processor_specific_flags()); |
3486 | 3483 | } |
3487 | 3484 | |
3488 | - // Whether the output uses N64 ABI. This is valid only after | |
3489 | - // merge_processor_specific_flags() is called. | |
3485 | + // Whether the output uses N64 ABI. | |
3490 | 3486 | bool |
3491 | 3487 | is_output_n64() const |
3492 | - { | |
3493 | - gold_assert(this->are_processor_specific_flags_set()); | |
3494 | - return elfcpp::abi_64(this->ei_class_); | |
3495 | - } | |
3488 | + { return size == 64; } | |
3496 | 3489 | |
3497 | 3490 | // Whether the output uses NEWABI. This is valid only after |
3498 | 3491 | // merge_processor_specific_flags() is called. |
@@ -3860,8 +3853,7 @@ class Target_mips : public Sized_target<size, big_endian> | ||
3860 | 3853 | |
3861 | 3854 | // Merge processor specific flags. |
3862 | 3855 | void |
3863 | - merge_processor_specific_flags(const std::string&, elfcpp::Elf_Word, | |
3864 | - unsigned char, bool); | |
3856 | + merge_processor_specific_flags(const std::string&, elfcpp::Elf_Word, bool); | |
3865 | 3857 | |
3866 | 3858 | // True if we are linking for CPUs that are faster if JAL is converted to BAL. |
3867 | 3859 | static inline bool |
@@ -3940,7 +3932,7 @@ class Target_mips : public Sized_target<size, big_endian> | ||
3940 | 3932 | set_gp(Layout*, Symbol_table*); |
3941 | 3933 | |
3942 | 3934 | const char* |
3943 | - elf_mips_abi_name(elfcpp::Elf_Word e_flags, unsigned char ei_class); | |
3935 | + elf_mips_abi_name(elfcpp::Elf_Word e_flags); | |
3944 | 3936 | const char* |
3945 | 3937 | elf_mips_mach_name(elfcpp::Elf_Word e_flags); |
3946 | 3938 |
@@ -4053,7 +4045,6 @@ class Target_mips : public Sized_target<size, big_endian> | ||
4053 | 4045 | // .MIPS.stubs |
4054 | 4046 | Mips_output_data_mips_stubs<size, big_endian>* mips_stubs_; |
4055 | 4047 | |
4056 | - unsigned char ei_class_; | |
4057 | 4048 | unsigned int mach_; |
4058 | 4049 | Layout* layout_; |
4059 | 4050 |
@@ -8352,14 +8343,12 @@ Target_mips<size, big_endian>::mips_mach_extends(unsigned int base, | ||
8352 | 8343 | template<int size, bool big_endian> |
8353 | 8344 | void |
8354 | 8345 | Target_mips<size, big_endian>::merge_processor_specific_flags( |
8355 | - const std::string& name, elfcpp::Elf_Word in_flags, | |
8356 | - unsigned char in_ei_class, bool dyn_obj) | |
8346 | + const std::string& name, elfcpp::Elf_Word in_flags, bool dyn_obj) | |
8357 | 8347 | { |
8358 | 8348 | // If flags are not set yet, just copy them. |
8359 | 8349 | if (!this->are_processor_specific_flags_set()) |
8360 | 8350 | { |
8361 | 8351 | this->set_processor_specific_flags(in_flags); |
8362 | - this->ei_class_ = in_ei_class; | |
8363 | 8352 | this->mach_ = this->elf_mips_mach(in_flags); |
8364 | 8353 | return; |
8365 | 8354 | } |
@@ -8441,19 +8430,16 @@ Target_mips<size, big_endian>::merge_processor_specific_flags( | ||
8441 | 8430 | old_flags &= (~(elfcpp::EF_MIPS_ARCH | elfcpp::EF_MIPS_MACH |
8442 | 8431 | | elfcpp::EF_MIPS_32BITMODE)); |
8443 | 8432 | |
8444 | - // Compare ABIs. The 64-bit ABI does not use EF_MIPS_ABI. But, it does set | |
8445 | - // EI_CLASS differently from any 32-bit ABI. | |
8446 | - if ((new_flags & elfcpp::EF_MIPS_ABI) != (old_flags & elfcpp::EF_MIPS_ABI) | |
8447 | - || (in_ei_class != this->ei_class_)) | |
8433 | + // Compare ABIs. | |
8434 | + if ((new_flags & elfcpp::EF_MIPS_ABI) != (old_flags & elfcpp::EF_MIPS_ABI)) | |
8448 | 8435 | { |
8449 | 8436 | // Only error if both are set (to different values). |
8450 | - if (((new_flags & elfcpp::EF_MIPS_ABI) | |
8437 | + if ((new_flags & elfcpp::EF_MIPS_ABI) | |
8451 | 8438 | && (old_flags & elfcpp::EF_MIPS_ABI)) |
8452 | - || (in_ei_class != this->ei_class_)) | |
8453 | 8439 | gold_error(_("%s: ABI mismatch: linking %s module with " |
8454 | 8440 | "previous %s modules"), name.c_str(), |
8455 | - this->elf_mips_abi_name(in_flags, in_ei_class), | |
8456 | - this->elf_mips_abi_name(merged_flags, this->ei_class_)); | |
8441 | + this->elf_mips_abi_name(in_flags), | |
8442 | + this->elf_mips_abi_name(merged_flags)); | |
8457 | 8443 | |
8458 | 8444 | new_flags &= ~elfcpp::EF_MIPS_ABI; |
8459 | 8445 | old_flags &= ~elfcpp::EF_MIPS_ABI; |
@@ -8501,16 +8487,13 @@ Target_mips<size, big_endian>::do_adjust_elf_header( | ||
8501 | 8487 | { |
8502 | 8488 | gold_assert(len == elfcpp::Elf_sizes<size>::ehdr_size); |
8503 | 8489 | |
8504 | - elfcpp::Ehdr<size, big_endian> ehdr(view); | |
8505 | - unsigned char e_ident[elfcpp::EI_NIDENT]; | |
8506 | - memcpy(e_ident, ehdr.get_e_ident(), elfcpp::EI_NIDENT); | |
8507 | - | |
8508 | - e_ident[elfcpp::EI_CLASS] = this->ei_class_; | |
8490 | + if (!this->entry_symbol_is_compressed_) | |
8491 | + return; | |
8509 | 8492 | |
8493 | + elfcpp::Ehdr<size, big_endian> ehdr(view); | |
8510 | 8494 | elfcpp::Ehdr_write<size, big_endian> oehdr(view); |
8511 | - oehdr.put_e_ident(e_ident); | |
8512 | - if (this->entry_symbol_is_compressed_) | |
8513 | - oehdr.put_e_entry(ehdr.get_e_entry() + 1); | |
8495 | + | |
8496 | + oehdr.put_e_entry(ehdr.get_e_entry() + 1); | |
8514 | 8497 | } |
8515 | 8498 | |
8516 | 8499 | // do_make_elf_object to override the same function in the base class. |
@@ -8625,7 +8608,6 @@ Target_mips<size, big_endian>::do_finalize_sections(Layout* layout, | ||
8625 | 8608 | |
8626 | 8609 | elfcpp::Ehdr<size, big_endian> ehdr(pehdr); |
8627 | 8610 | elfcpp::Elf_Word in_flags = ehdr.get_e_flags(); |
8628 | - unsigned char ei_class = ehdr.get_e_ident()[elfcpp::EI_CLASS]; | |
8629 | 8611 | // If all input sections will be discarded, don't use this object |
8630 | 8612 | // file for merging processor specific flags. |
8631 | 8613 | bool should_merge_processor_specific_flags = false; |
@@ -8639,7 +8621,7 @@ Target_mips<size, big_endian>::do_finalize_sections(Layout* layout, | ||
8639 | 8621 | |
8640 | 8622 | if (should_merge_processor_specific_flags) |
8641 | 8623 | this->merge_processor_specific_flags(relobj->name(), in_flags, |
8642 | - ei_class, false); | |
8624 | + false); | |
8643 | 8625 | } |
8644 | 8626 | } |
8645 | 8627 |
@@ -8657,10 +8639,8 @@ Target_mips<size, big_endian>::do_finalize_sections(Layout* layout, | ||
8657 | 8639 | |
8658 | 8640 | elfcpp::Ehdr<size, big_endian> ehdr(pehdr); |
8659 | 8641 | elfcpp::Elf_Word in_flags = ehdr.get_e_flags(); |
8660 | - unsigned char ei_class = ehdr.get_e_ident()[elfcpp::EI_CLASS]; | |
8661 | 8642 | |
8662 | - this->merge_processor_specific_flags(dynobj->name(), in_flags, ei_class, | |
8663 | - true); | |
8643 | + this->merge_processor_specific_flags(dynobj->name(), in_flags, true); | |
8664 | 8644 | } |
8665 | 8645 | |
8666 | 8646 | // Merge .reginfo contents of input objects. |
@@ -11238,15 +11218,14 @@ Target_mips<size, big_endian>::Scan::unsupported_reloc_global( | ||
11238 | 11218 | // Return printable name for ABI. |
11239 | 11219 | template<int size, bool big_endian> |
11240 | 11220 | const char* |
11241 | -Target_mips<size, big_endian>::elf_mips_abi_name(elfcpp::Elf_Word e_flags, | |
11242 | - unsigned char ei_class) | |
11221 | +Target_mips<size, big_endian>::elf_mips_abi_name(elfcpp::Elf_Word e_flags) | |
11243 | 11222 | { |
11244 | 11223 | switch (e_flags & elfcpp::EF_MIPS_ABI) |
11245 | 11224 | { |
11246 | 11225 | case 0: |
11247 | 11226 | if ((e_flags & elfcpp::EF_MIPS_ABI2) != 0) |
11248 | 11227 | return "N32"; |
11249 | - else if (elfcpp::abi_64(ei_class)) | |
11228 | + else if (size == 64) | |
11250 | 11229 | return "64"; |
11251 | 11230 | else |
11252 | 11231 | return "none"; |