GNU Binutils with patches for OS216
修訂 | 152c92b261fd9e4655688bef746ca32352f56bc4 (tree) |
---|---|
時間 | 2017-03-16 08:51:35 |
作者 | Vladimir Radosavljevic <Vladimir.Radosavljevic@imgt...> |
Commiter | Cary Coutant |
Mips: Add support for resolving multiple consecutive relocations.
gold/
* mips.cc (Target_mips::Relocate::calculated_value_): New data
member.
(Target_mips::Relocate::calculate_only_): Likewise.
(Target_mips::Relocate::relocate): Handle multiple consecutive
relocations with the same offset.
@@ -1,5 +1,13 @@ | ||
1 | 1 | 2017-03-15 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com> |
2 | 2 | |
3 | + * mips.cc (Target_mips::Relocate::calculated_value_): New data | |
4 | + member. | |
5 | + (Target_mips::Relocate::calculate_only_): Likewise. | |
6 | + (Target_mips::Relocate::relocate): Handle multiple consecutive | |
7 | + relocations with the same offset. | |
8 | + | |
9 | +2017-03-15 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com> | |
10 | + | |
3 | 11 | * mips.cc (Target_mips::Relocate::relocate): Remove redundant |
4 | 12 | checks for relocatable link. |
5 | 13 | (Mips_relocate_functions::reljalr): Likewise. |
@@ -3857,6 +3857,7 @@ class Target_mips : public Sized_target<size, big_endian> | ||
3857 | 3857 | { |
3858 | 3858 | public: |
3859 | 3859 | Relocate() |
3860 | + : calculated_value_(0), calculate_only_(false) | |
3860 | 3861 | { } |
3861 | 3862 | |
3862 | 3863 | ~Relocate() |
@@ -3876,6 +3877,12 @@ class Target_mips : public Sized_target<size, big_endian> | ||
3876 | 3877 | Target_mips*, Output_section*, size_t, const unsigned char*, |
3877 | 3878 | const Sized_symbol<size>*, const Symbol_value<size>*, |
3878 | 3879 | unsigned char*, Mips_address, section_size_type); |
3880 | + | |
3881 | + private: | |
3882 | + // Result of the relocation. | |
3883 | + Valtype calculated_value_; | |
3884 | + // Whether we have to calculate relocation instead of applying it. | |
3885 | + bool calculate_only_; | |
3879 | 3886 | }; |
3880 | 3887 | |
3881 | 3888 | // This POD class holds the dynamic relocations that should be emitted instead |
@@ -11428,6 +11435,13 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11428 | 11435 | unsigned int r_type3; |
11429 | 11436 | unsigned char r_ssym; |
11430 | 11437 | typename elfcpp::Elf_types<size>::Elf_Swxword r_addend; |
11438 | + // r_offset and r_type of the next relocation is needed for resolving multiple | |
11439 | + // consecutive relocations with the same offset. | |
11440 | + Mips_address next_r_offset = static_cast<Mips_address>(0) - 1; | |
11441 | + unsigned int next_r_type = elfcpp::R_MIPS_NONE; | |
11442 | + | |
11443 | + elfcpp::Shdr<size, big_endian> shdr(relinfo->reloc_shdr); | |
11444 | + size_t reloc_count = shdr.get_sh_size() / shdr.get_sh_entsize(); | |
11431 | 11445 | |
11432 | 11446 | if (rel_type == elfcpp::SHT_RELA) |
11433 | 11447 | { |
@@ -11444,6 +11458,17 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11444 | 11458 | r_ssym = Mips_classify_reloc<elfcpp::SHT_RELA, size, big_endian>:: |
11445 | 11459 | get_r_ssym(&rela); |
11446 | 11460 | r_addend = rela.get_r_addend(); |
11461 | + // If this is not last relocation, get r_offset and r_type of the next | |
11462 | + // relocation. | |
11463 | + if (relnum + 1 < reloc_count) | |
11464 | + { | |
11465 | + const int reloc_size = elfcpp::Elf_sizes<size>::rela_size; | |
11466 | + const Relatype next_rela(preloc + reloc_size); | |
11467 | + next_r_offset = next_rela.get_r_offset(); | |
11468 | + next_r_type = | |
11469 | + Mips_classify_reloc<elfcpp::SHT_RELA, size, big_endian>:: | |
11470 | + get_r_type(&next_rela); | |
11471 | + } | |
11447 | 11472 | } |
11448 | 11473 | else |
11449 | 11474 | { |
@@ -11454,9 +11479,19 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11454 | 11479 | r_type = Mips_classify_reloc<elfcpp::SHT_REL, size, big_endian>:: |
11455 | 11480 | get_r_type(&rel); |
11456 | 11481 | r_ssym = 0; |
11457 | - r_type2 = 0; | |
11458 | - r_type3 = 0; | |
11482 | + r_type2 = elfcpp::R_MIPS_NONE; | |
11483 | + r_type3 = elfcpp::R_MIPS_NONE; | |
11459 | 11484 | r_addend = 0; |
11485 | + // If this is not last relocation, get r_offset and r_type of the next | |
11486 | + // relocation. | |
11487 | + if (relnum + 1 < reloc_count) | |
11488 | + { | |
11489 | + const int reloc_size = elfcpp::Elf_sizes<size>::rel_size; | |
11490 | + const Reltype next_rel(preloc + reloc_size); | |
11491 | + next_r_offset = next_rel.get_r_offset(); | |
11492 | + next_r_type = Mips_classify_reloc<elfcpp::SHT_REL, size, big_endian>:: | |
11493 | + get_r_type(&next_rel); | |
11494 | + } | |
11460 | 11495 | } |
11461 | 11496 | |
11462 | 11497 | typedef Mips_relocate_functions<size, big_endian> Reloc_funcs; |
@@ -11716,8 +11751,7 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11716 | 11751 | unsigned int got_offset = 0; |
11717 | 11752 | int gp_offset = 0; |
11718 | 11753 | |
11719 | - bool calculate_only = false; | |
11720 | - Valtype calculated_value = 0; | |
11754 | + // Whether we have to extract addend from instruction. | |
11721 | 11755 | bool extract_addend = rel_type == elfcpp::SHT_REL; |
11722 | 11756 | unsigned int r_types[3] = { r_type, r_type2, r_type3 }; |
11723 | 11757 |
@@ -11740,10 +11774,23 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11740 | 11774 | if (r_types[i] == elfcpp::R_MIPS_NONE) |
11741 | 11775 | break; |
11742 | 11776 | |
11743 | - // TODO(Vladimir) | |
11744 | - // Check if the next relocation is for the same instruction. | |
11745 | - calculate_only = i == 2 ? false | |
11746 | - : r_types[i+1] != elfcpp::R_MIPS_NONE; | |
11777 | + // If we didn't apply previous relocation, use its result as addend | |
11778 | + // for current. | |
11779 | + if (this->calculate_only_) | |
11780 | + { | |
11781 | + r_addend = this->calculated_value_; | |
11782 | + extract_addend = false; | |
11783 | + } | |
11784 | + | |
11785 | + // In the N32 and 64-bit ABIs there may be multiple consecutive | |
11786 | + // relocations for the same offset. In that case we are | |
11787 | + // supposed to treat the output of each relocation as the addend | |
11788 | + // for the next. For N64 ABI, we are checking offsets only in a | |
11789 | + // third operation in a record (r_type3). | |
11790 | + this->calculate_only_ = | |
11791 | + (object->is_n64() && i < 2 | |
11792 | + ? r_types[i+1] != elfcpp::R_MIPS_NONE | |
11793 | + : (r_offset == next_r_offset) && (next_r_type != elfcpp::R_MIPS_NONE)); | |
11747 | 11794 | |
11748 | 11795 | if (object->is_n64()) |
11749 | 11796 | { |
@@ -11783,16 +11830,18 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11783 | 11830 | break; |
11784 | 11831 | case elfcpp::R_MIPS_16: |
11785 | 11832 | reloc_status = Reloc_funcs::rel16(view, object, psymval, r_addend, |
11786 | - extract_addend, calculate_only, | |
11787 | - &calculated_value); | |
11833 | + extract_addend, | |
11834 | + this->calculate_only_, | |
11835 | + &this->calculated_value_); | |
11788 | 11836 | break; |
11789 | 11837 | |
11790 | 11838 | case elfcpp::R_MIPS_32: |
11791 | 11839 | if (should_apply_static_reloc(mips_sym, r_types[i], output_section, |
11792 | 11840 | target)) |
11793 | 11841 | reloc_status = Reloc_funcs::rel32(view, object, psymval, r_addend, |
11794 | - extract_addend, calculate_only, | |
11795 | - &calculated_value); | |
11842 | + extract_addend, | |
11843 | + this->calculate_only_, | |
11844 | + &this->calculated_value_); | |
11796 | 11845 | if (mips_sym != NULL |
11797 | 11846 | && (mips_sym->is_mips16() || mips_sym->is_micromips()) |
11798 | 11847 | && mips_sym->global_got_area() == GGA_RELOC_ONLY) |
@@ -11817,14 +11866,16 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11817 | 11866 | if (should_apply_static_reloc(mips_sym, r_types[i], output_section, |
11818 | 11867 | target)) |
11819 | 11868 | reloc_status = Reloc_funcs::rel64(view, object, psymval, r_addend, |
11820 | - extract_addend, calculate_only, | |
11821 | - &calculated_value, false); | |
11869 | + extract_addend, | |
11870 | + this->calculate_only_, | |
11871 | + &this->calculated_value_, false); | |
11822 | 11872 | else if (target->is_output_n64() && r_addend != 0) |
11823 | 11873 | // Only apply the addend. The static relocation was RELA, but the |
11824 | 11874 | // dynamic relocation is REL, so we need to apply the addend. |
11825 | 11875 | reloc_status = Reloc_funcs::rel64(view, object, psymval, r_addend, |
11826 | - extract_addend, calculate_only, | |
11827 | - &calculated_value, true); | |
11876 | + extract_addend, | |
11877 | + this->calculate_only_, | |
11878 | + &this->calculated_value_, true); | |
11828 | 11879 | break; |
11829 | 11880 | case elfcpp::R_MIPS_REL32: |
11830 | 11881 | gold_unreachable(); |
@@ -11832,8 +11883,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11832 | 11883 | case elfcpp::R_MIPS_PC32: |
11833 | 11884 | reloc_status = Reloc_funcs::relpc32(view, object, psymval, address, |
11834 | 11885 | r_addend, extract_addend, |
11835 | - calculate_only, | |
11836 | - &calculated_value); | |
11886 | + this->calculate_only_, | |
11887 | + &this->calculated_value_); | |
11837 | 11888 | break; |
11838 | 11889 | |
11839 | 11890 | case elfcpp::R_MIPS16_26: |
@@ -11845,8 +11896,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11845 | 11896 | case elfcpp::R_MICROMIPS_26_S1: |
11846 | 11897 | reloc_status = Reloc_funcs::rel26(view, object, psymval, address, |
11847 | 11898 | gsym == NULL, r_addend, extract_addend, gsym, cross_mode_jump, |
11848 | - r_types[i], target->jal_to_bal(), calculate_only, | |
11849 | - &calculated_value); | |
11899 | + r_types[i], target->jal_to_bal(), this->calculate_only_, | |
11900 | + &this->calculated_value_); | |
11850 | 11901 | break; |
11851 | 11902 | |
11852 | 11903 | case elfcpp::R_MIPS_HI16: |
@@ -11857,8 +11908,9 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11857 | 11908 | r_addend, address, |
11858 | 11909 | gp_disp, r_types[i], |
11859 | 11910 | extract_addend, 0, |
11860 | - target, calculate_only, | |
11861 | - &calculated_value); | |
11911 | + target, | |
11912 | + this->calculate_only_, | |
11913 | + &this->calculated_value_); | |
11862 | 11914 | else if (rel_type == elfcpp::SHT_REL) |
11863 | 11915 | reloc_status = Reloc_funcs::relhi16(view, object, psymval, r_addend, |
11864 | 11916 | address, gp_disp, r_types[i], |
@@ -11874,8 +11926,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11874 | 11926 | reloc_status = Reloc_funcs::rello16(target, view, object, psymval, |
11875 | 11927 | r_addend, extract_addend, address, |
11876 | 11928 | gp_disp, r_types[i], r_sym, |
11877 | - rel_type, calculate_only, | |
11878 | - &calculated_value); | |
11929 | + rel_type, this->calculate_only_, | |
11930 | + &this->calculated_value_); | |
11879 | 11931 | break; |
11880 | 11932 | |
11881 | 11933 | case elfcpp::R_MIPS_LITERAL: |
@@ -11895,42 +11947,43 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11895 | 11947 | target->adjusted_gp_value(object), |
11896 | 11948 | r_addend, extract_addend, |
11897 | 11949 | gsym == NULL, r_types[i], |
11898 | - calculate_only, &calculated_value); | |
11950 | + this->calculate_only_, | |
11951 | + &this->calculated_value_); | |
11899 | 11952 | break; |
11900 | 11953 | |
11901 | 11954 | case elfcpp::R_MIPS_PC16: |
11902 | 11955 | reloc_status = Reloc_funcs::relpc16(view, object, psymval, address, |
11903 | 11956 | r_addend, extract_addend, |
11904 | - calculate_only, | |
11905 | - &calculated_value); | |
11957 | + this->calculate_only_, | |
11958 | + &this->calculated_value_); | |
11906 | 11959 | break; |
11907 | 11960 | |
11908 | 11961 | case elfcpp::R_MIPS_PC21_S2: |
11909 | 11962 | reloc_status = Reloc_funcs::relpc21(view, object, psymval, address, |
11910 | 11963 | r_addend, extract_addend, |
11911 | - calculate_only, | |
11912 | - &calculated_value); | |
11964 | + this->calculate_only_, | |
11965 | + &this->calculated_value_); | |
11913 | 11966 | break; |
11914 | 11967 | |
11915 | 11968 | case elfcpp::R_MIPS_PC26_S2: |
11916 | 11969 | reloc_status = Reloc_funcs::relpc26(view, object, psymval, address, |
11917 | 11970 | r_addend, extract_addend, |
11918 | - calculate_only, | |
11919 | - &calculated_value); | |
11971 | + this->calculate_only_, | |
11972 | + &this->calculated_value_); | |
11920 | 11973 | break; |
11921 | 11974 | |
11922 | 11975 | case elfcpp::R_MIPS_PC18_S3: |
11923 | 11976 | reloc_status = Reloc_funcs::relpc18(view, object, psymval, address, |
11924 | 11977 | r_addend, extract_addend, |
11925 | - calculate_only, | |
11926 | - &calculated_value); | |
11978 | + this->calculate_only_, | |
11979 | + &this->calculated_value_); | |
11927 | 11980 | break; |
11928 | 11981 | |
11929 | 11982 | case elfcpp::R_MIPS_PC19_S2: |
11930 | 11983 | reloc_status = Reloc_funcs::relpc19(view, object, psymval, address, |
11931 | 11984 | r_addend, extract_addend, |
11932 | - calculate_only, | |
11933 | - &calculated_value); | |
11985 | + this->calculate_only_, | |
11986 | + &this->calculated_value_); | |
11934 | 11987 | break; |
11935 | 11988 | |
11936 | 11989 | case elfcpp::R_MIPS_PCHI16: |
@@ -11938,8 +11991,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11938 | 11991 | reloc_status = Reloc_funcs::do_relpchi16(view, object, psymval, |
11939 | 11992 | r_addend, address, |
11940 | 11993 | extract_addend, 0, |
11941 | - calculate_only, | |
11942 | - &calculated_value); | |
11994 | + this->calculate_only_, | |
11995 | + &this->calculated_value_); | |
11943 | 11996 | else if (rel_type == elfcpp::SHT_REL) |
11944 | 11997 | reloc_status = Reloc_funcs::relpchi16(view, object, psymval, |
11945 | 11998 | r_addend, address, r_sym, |
@@ -11951,36 +12004,36 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11951 | 12004 | case elfcpp::R_MIPS_PCLO16: |
11952 | 12005 | reloc_status = Reloc_funcs::relpclo16(view, object, psymval, r_addend, |
11953 | 12006 | extract_addend, address, r_sym, |
11954 | - rel_type, calculate_only, | |
11955 | - &calculated_value); | |
12007 | + rel_type, this->calculate_only_, | |
12008 | + &this->calculated_value_); | |
11956 | 12009 | break; |
11957 | 12010 | case elfcpp::R_MICROMIPS_PC7_S1: |
11958 | 12011 | reloc_status = Reloc_funcs::relmicromips_pc7_s1(view, object, psymval, |
11959 | - address, r_addend, | |
11960 | - extract_addend, | |
11961 | - calculate_only, | |
11962 | - &calculated_value); | |
12012 | + address, r_addend, | |
12013 | + extract_addend, | |
12014 | + this->calculate_only_, | |
12015 | + &this->calculated_value_); | |
11963 | 12016 | break; |
11964 | 12017 | case elfcpp::R_MICROMIPS_PC10_S1: |
11965 | 12018 | reloc_status = Reloc_funcs::relmicromips_pc10_s1(view, object, |
11966 | - psymval, address, | |
11967 | - r_addend, extract_addend, | |
11968 | - calculate_only, | |
11969 | - &calculated_value); | |
12019 | + psymval, address, | |
12020 | + r_addend, extract_addend, | |
12021 | + this->calculate_only_, | |
12022 | + &this->calculated_value_); | |
11970 | 12023 | break; |
11971 | 12024 | case elfcpp::R_MICROMIPS_PC16_S1: |
11972 | 12025 | reloc_status = Reloc_funcs::relmicromips_pc16_s1(view, object, |
11973 | - psymval, address, | |
11974 | - r_addend, extract_addend, | |
11975 | - calculate_only, | |
11976 | - &calculated_value); | |
12026 | + psymval, address, | |
12027 | + r_addend, extract_addend, | |
12028 | + this->calculate_only_, | |
12029 | + &this->calculated_value_); | |
11977 | 12030 | break; |
11978 | 12031 | case elfcpp::R_MIPS_GPREL32: |
11979 | 12032 | reloc_status = Reloc_funcs::relgprel32(view, object, psymval, |
11980 | 12033 | target->adjusted_gp_value(object), |
11981 | 12034 | r_addend, extract_addend, |
11982 | - calculate_only, | |
11983 | - &calculated_value); | |
12035 | + this->calculate_only_, | |
12036 | + &this->calculated_value_); | |
11984 | 12037 | break; |
11985 | 12038 | case elfcpp::R_MIPS_GOT_HI16: |
11986 | 12039 | case elfcpp::R_MIPS_CALL_HI16: |
@@ -11996,8 +12049,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
11996 | 12049 | object, r_addend); |
11997 | 12050 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
11998 | 12051 | reloc_status = Reloc_funcs::relgot_hi16(view, gp_offset, |
11999 | - calculate_only, | |
12000 | - &calculated_value); | |
12052 | + this->calculate_only_, | |
12053 | + &this->calculated_value_); | |
12001 | 12054 | update_got_entry = changed_symbol_value; |
12002 | 12055 | break; |
12003 | 12056 |
@@ -12015,8 +12068,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12015 | 12068 | object, r_addend); |
12016 | 12069 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12017 | 12070 | reloc_status = Reloc_funcs::relgot_lo16(view, gp_offset, |
12018 | - calculate_only, | |
12019 | - &calculated_value); | |
12071 | + this->calculate_only_, | |
12072 | + &this->calculated_value_); | |
12020 | 12073 | update_got_entry = changed_symbol_value; |
12021 | 12074 | break; |
12022 | 12075 |
@@ -12034,12 +12087,12 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12034 | 12087 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12035 | 12088 | if (eh_reloc(r_types[i])) |
12036 | 12089 | reloc_status = Reloc_funcs::releh(view, gp_offset, |
12037 | - calculate_only, | |
12038 | - &calculated_value); | |
12090 | + this->calculate_only_, | |
12091 | + &this->calculated_value_); | |
12039 | 12092 | else |
12040 | 12093 | reloc_status = Reloc_funcs::relgot(view, gp_offset, |
12041 | - calculate_only, | |
12042 | - &calculated_value); | |
12094 | + this->calculate_only_, | |
12095 | + &this->calculated_value_); | |
12043 | 12096 | break; |
12044 | 12097 | case elfcpp::R_MIPS_CALL16: |
12045 | 12098 | case elfcpp::R_MIPS16_CALL16: |
@@ -12050,7 +12103,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12050 | 12103 | object); |
12051 | 12104 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12052 | 12105 | reloc_status = Reloc_funcs::relgot(view, gp_offset, |
12053 | - calculate_only, &calculated_value); | |
12106 | + this->calculate_only_, | |
12107 | + &this->calculated_value_); | |
12054 | 12108 | // TODO(sasa): We should also initialize update_got_entry |
12055 | 12109 | // in other place swhere relgot is called. |
12056 | 12110 | update_got_entry = changed_symbol_value; |
@@ -12066,18 +12120,18 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12066 | 12120 | object); |
12067 | 12121 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12068 | 12122 | reloc_status = Reloc_funcs::relgot(view, gp_offset, |
12069 | - calculate_only, | |
12070 | - &calculated_value); | |
12123 | + this->calculate_only_, | |
12124 | + &this->calculated_value_); | |
12071 | 12125 | } |
12072 | 12126 | else |
12073 | 12127 | { |
12074 | 12128 | if (rel_type == elfcpp::SHT_RELA) |
12075 | 12129 | reloc_status = Reloc_funcs::do_relgot16_local(view, object, |
12076 | - psymval, r_addend, | |
12077 | - extract_addend, 0, | |
12078 | - target, | |
12079 | - calculate_only, | |
12080 | - &calculated_value); | |
12130 | + psymval, r_addend, | |
12131 | + extract_addend, 0, | |
12132 | + target, | |
12133 | + this->calculate_only_, | |
12134 | + &this->calculated_value_); | |
12081 | 12135 | else if (rel_type == elfcpp::SHT_REL) |
12082 | 12136 | reloc_status = Reloc_funcs::relgot16_local(view, object, |
12083 | 12137 | psymval, r_addend, |
@@ -12101,8 +12155,9 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12101 | 12155 | GOT_TYPE_TLS_PAIR, |
12102 | 12156 | object, r_addend); |
12103 | 12157 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12104 | - reloc_status = Reloc_funcs::relgot(view, gp_offset, calculate_only, | |
12105 | - &calculated_value); | |
12158 | + reloc_status = Reloc_funcs::relgot(view, gp_offset, | |
12159 | + this->calculate_only_, | |
12160 | + &this->calculated_value_); | |
12106 | 12161 | break; |
12107 | 12162 | |
12108 | 12163 | case elfcpp::R_MIPS_TLS_GOTTPREL: |
@@ -12117,8 +12172,9 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12117 | 12172 | GOT_TYPE_TLS_OFFSET, |
12118 | 12173 | object, r_addend); |
12119 | 12174 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12120 | - reloc_status = Reloc_funcs::relgot(view, gp_offset, calculate_only, | |
12121 | - &calculated_value); | |
12175 | + reloc_status = Reloc_funcs::relgot(view, gp_offset, | |
12176 | + this->calculate_only_, | |
12177 | + &this->calculated_value_); | |
12122 | 12178 | break; |
12123 | 12179 | |
12124 | 12180 | case elfcpp::R_MIPS_TLS_LDM: |
@@ -12128,24 +12184,25 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12128 | 12184 | // the module index. |
12129 | 12185 | got_offset = target->got_section()->tls_ldm_offset(object); |
12130 | 12186 | gp_offset = target->got_section()->gp_offset(got_offset, object); |
12131 | - reloc_status = Reloc_funcs::relgot(view, gp_offset, calculate_only, | |
12132 | - &calculated_value); | |
12187 | + reloc_status = Reloc_funcs::relgot(view, gp_offset, | |
12188 | + this->calculate_only_, | |
12189 | + &this->calculated_value_); | |
12133 | 12190 | break; |
12134 | 12191 | |
12135 | 12192 | case elfcpp::R_MIPS_GOT_PAGE: |
12136 | 12193 | case elfcpp::R_MICROMIPS_GOT_PAGE: |
12137 | 12194 | reloc_status = Reloc_funcs::relgotpage(target, view, object, psymval, |
12138 | 12195 | r_addend, extract_addend, |
12139 | - calculate_only, | |
12140 | - &calculated_value); | |
12196 | + this->calculate_only_, | |
12197 | + &this->calculated_value_); | |
12141 | 12198 | break; |
12142 | 12199 | |
12143 | 12200 | case elfcpp::R_MIPS_GOT_OFST: |
12144 | 12201 | case elfcpp::R_MICROMIPS_GOT_OFST: |
12145 | 12202 | reloc_status = Reloc_funcs::relgotofst(target, view, object, psymval, |
12146 | 12203 | r_addend, extract_addend, |
12147 | - local, calculate_only, | |
12148 | - &calculated_value); | |
12204 | + local, this->calculate_only_, | |
12205 | + &this->calculated_value_); | |
12149 | 12206 | break; |
12150 | 12207 | |
12151 | 12208 | case elfcpp::R_MIPS_JALR: |
@@ -12160,8 +12217,8 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12160 | 12217 | cross_mode_jump, r_types[i], |
12161 | 12218 | target->jalr_to_bal(), |
12162 | 12219 | target->jr_to_b(), |
12163 | - calculate_only, | |
12164 | - &calculated_value); | |
12220 | + this->calculate_only_, | |
12221 | + &this->calculated_value_); | |
12165 | 12222 | break; |
12166 | 12223 | |
12167 | 12224 | case elfcpp::R_MIPS_TLS_DTPREL_HI16: |
@@ -12169,65 +12226,73 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12169 | 12226 | case elfcpp::R_MICROMIPS_TLS_DTPREL_HI16: |
12170 | 12227 | reloc_status = Reloc_funcs::tlsrelhi16(view, object, psymval, |
12171 | 12228 | elfcpp::DTP_OFFSET, r_addend, |
12172 | - extract_addend, calculate_only, | |
12173 | - &calculated_value); | |
12229 | + extract_addend, | |
12230 | + this->calculate_only_, | |
12231 | + &this->calculated_value_); | |
12174 | 12232 | break; |
12175 | 12233 | case elfcpp::R_MIPS_TLS_DTPREL_LO16: |
12176 | 12234 | case elfcpp::R_MIPS16_TLS_DTPREL_LO16: |
12177 | 12235 | case elfcpp::R_MICROMIPS_TLS_DTPREL_LO16: |
12178 | 12236 | reloc_status = Reloc_funcs::tlsrello16(view, object, psymval, |
12179 | 12237 | elfcpp::DTP_OFFSET, r_addend, |
12180 | - extract_addend, calculate_only, | |
12181 | - &calculated_value); | |
12238 | + extract_addend, | |
12239 | + this->calculate_only_, | |
12240 | + &this->calculated_value_); | |
12182 | 12241 | break; |
12183 | 12242 | case elfcpp::R_MIPS_TLS_DTPREL32: |
12184 | 12243 | case elfcpp::R_MIPS_TLS_DTPREL64: |
12185 | 12244 | reloc_status = Reloc_funcs::tlsrel32(view, object, psymval, |
12186 | 12245 | elfcpp::DTP_OFFSET, r_addend, |
12187 | - extract_addend, calculate_only, | |
12188 | - &calculated_value); | |
12246 | + extract_addend, | |
12247 | + this->calculate_only_, | |
12248 | + &this->calculated_value_); | |
12189 | 12249 | break; |
12190 | 12250 | case elfcpp::R_MIPS_TLS_TPREL_HI16: |
12191 | 12251 | case elfcpp::R_MIPS16_TLS_TPREL_HI16: |
12192 | 12252 | case elfcpp::R_MICROMIPS_TLS_TPREL_HI16: |
12193 | 12253 | reloc_status = Reloc_funcs::tlsrelhi16(view, object, psymval, |
12194 | 12254 | elfcpp::TP_OFFSET, r_addend, |
12195 | - extract_addend, calculate_only, | |
12196 | - &calculated_value); | |
12255 | + extract_addend, | |
12256 | + this->calculate_only_, | |
12257 | + &this->calculated_value_); | |
12197 | 12258 | break; |
12198 | 12259 | case elfcpp::R_MIPS_TLS_TPREL_LO16: |
12199 | 12260 | case elfcpp::R_MIPS16_TLS_TPREL_LO16: |
12200 | 12261 | case elfcpp::R_MICROMIPS_TLS_TPREL_LO16: |
12201 | 12262 | reloc_status = Reloc_funcs::tlsrello16(view, object, psymval, |
12202 | 12263 | elfcpp::TP_OFFSET, r_addend, |
12203 | - extract_addend, calculate_only, | |
12204 | - &calculated_value); | |
12264 | + extract_addend, | |
12265 | + this->calculate_only_, | |
12266 | + &this->calculated_value_); | |
12205 | 12267 | break; |
12206 | 12268 | case elfcpp::R_MIPS_TLS_TPREL32: |
12207 | 12269 | case elfcpp::R_MIPS_TLS_TPREL64: |
12208 | 12270 | reloc_status = Reloc_funcs::tlsrel32(view, object, psymval, |
12209 | 12271 | elfcpp::TP_OFFSET, r_addend, |
12210 | - extract_addend, calculate_only, | |
12211 | - &calculated_value); | |
12272 | + extract_addend, | |
12273 | + this->calculate_only_, | |
12274 | + &this->calculated_value_); | |
12212 | 12275 | break; |
12213 | 12276 | case elfcpp::R_MIPS_SUB: |
12214 | 12277 | case elfcpp::R_MICROMIPS_SUB: |
12215 | 12278 | reloc_status = Reloc_funcs::relsub(view, object, psymval, r_addend, |
12216 | 12279 | extract_addend, |
12217 | - calculate_only, &calculated_value); | |
12280 | + this->calculate_only_, | |
12281 | + &this->calculated_value_); | |
12218 | 12282 | break; |
12219 | 12283 | case elfcpp::R_MIPS_HIGHER: |
12220 | 12284 | case elfcpp::R_MICROMIPS_HIGHER: |
12221 | 12285 | reloc_status = Reloc_funcs::relhigher(view, object, psymval, r_addend, |
12222 | - extract_addend, calculate_only, | |
12223 | - &calculated_value); | |
12286 | + extract_addend, | |
12287 | + this->calculate_only_, | |
12288 | + &this->calculated_value_); | |
12224 | 12289 | break; |
12225 | 12290 | case elfcpp::R_MIPS_HIGHEST: |
12226 | 12291 | case elfcpp::R_MICROMIPS_HIGHEST: |
12227 | 12292 | reloc_status = Reloc_funcs::relhighest(view, object, psymval, |
12228 | 12293 | r_addend, extract_addend, |
12229 | - calculate_only, | |
12230 | - &calculated_value); | |
12294 | + this->calculate_only_, | |
12295 | + &this->calculated_value_); | |
12231 | 12296 | break; |
12232 | 12297 | default: |
12233 | 12298 | gold_error_at_location(relinfo, relnum, r_offset, |
@@ -12244,8 +12309,6 @@ Target_mips<size, big_endian>::Relocate::relocate( | ||
12244 | 12309 | else |
12245 | 12310 | got->update_got_entry(got_offset, psymval->value(object, 0)); |
12246 | 12311 | } |
12247 | - | |
12248 | - r_addend = calculated_value; | |
12249 | 12312 | } |
12250 | 12313 | |
12251 | 12314 | bool jal_shuffle = jal_reloc(r_type); |