Skip to content

Commit f5b1175

Browse files
Vladimir Radosavljevicccoutant
authored andcommitted
Add support for Mips32r6 and Mips64r6.
elfcpp/ * mips.h (R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16, R_MIPS_PCLO16): New enums for Mips32r6 and Mips64r6 relocations. (r6_isa): New function. gold/ * mips.cc (relocation_needs_la25_stub): Add support for relocs: R_MIPS_PC21_S2 and R_MIPS_PC26_S2. (hi16_reloc): Add support for R_MIPS_PCHI16 relocation. (is_matching_lo16_reloc): Likewise. (lo16_reloc): Add support for R_MIPS_PCLO16 relocation. (Mips_output_data_plt::plt_entry_r6): New static data member for R6 PLT entry. (Target_mips::is_output_r6): New method. (Target_mips::Mips_mach): Add new enum constants. (Mips_relocate_functions::Status): Likewise. (Mips_relocate_functions::pchi16_relocs): New static data member. (Mips_relocate_functions::relpc21): New method. (Mips_relocate_functions::relpc26): Likewise. (Mips_relocate_functions::relpc18): Likewise. (Mips_relocate_functions::relpc19): Likewise. (Mips_relocate_functions::relpchi16): Likewise. (Mips_relocate_functions::do_relpchi16): Likewise. (Mips_relocate_functions::relpclo16): Likewise. (Mips_output_data_plt::do_write): Add support for Mips r6 plt entry. (Target_mips::mips_32bit_flags): Add E_MIPS_ARCH_32R6 support. (Target_mips::elf_mips_mach): Add E_MIPS_ARCH_32R6 and E_MIPS_ARCH_64R6 support. (Target_mips::update_abiflags_isa): Likewise. (mips_get_size_for_reloc): Add support for relocs: R_MIPS_PCHI16, R_MIPS_PCLO16, R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3 and R_MIPS_PC19_S2. (Target_mips::Scan::local): Add support for relocs: R_MIPS_PCHI16 and R_MIPS_PCLO16. (Target_mips::Scan::global): Add support for relocs: R_MIPS_PC21_S2 and R_MIPS_PC26_S2. (Target_mips::Relocate::relocate): Call functions for resolving Mips32r6 and Mips64r6 relocations, and print error message for STATUS_PCREL_UNALIGNED. (Target_mips::Scan::get_reference_flags): Add support for relocs: R_MIPS_PCHI16, R_MIPS_PCLO16, R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3 and R_MIPS_PC19_S2. (Target_mips::elf_mips_mach_name): Add E_MIPS_ARCH_32R6 and E_MIPS_ARCH_64R6 support.
1 parent 7dc3990 commit f5b1175

4 files changed

Lines changed: 407 additions & 10 deletions

File tree

‎elfcpp/ChangeLog‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2016-06-20 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
2+
3+
* mips.h (R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3,
4+
R_MIPS_PC19_S2, R_MIPS_PCHI16, R_MIPS_PCLO16): New enums for
5+
Mips32r6 and Mips64r6 relocations.
6+
(r6_isa): New function.
7+
18
2016-06-10 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
29

310
* elfcpp.h (SHT_MIPS_ABIFLAGS): New enum constant.

‎elfcpp/mips.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ enum
9898
R_MIPS_TLS_TPREL_HI16 = 49,
9999
R_MIPS_TLS_TPREL_LO16 = 50,
100100
R_MIPS_GLOB_DAT = 51,
101+
R_MIPS_PC21_S2 = 60,
102+
R_MIPS_PC26_S2 = 61,
103+
R_MIPS_PC18_S3 = 62,
104+
R_MIPS_PC19_S2 = 63,
105+
R_MIPS_PCHI16 = 64,
106+
R_MIPS_PCLO16 = 65,
101107
// These relocs are used for the mips16.
102108
R_MIPS16_26 = 100,
103109
R_MIPS16_GPREL = 101,
@@ -479,6 +485,14 @@ bool
479485
abi_n32(elfcpp::Elf_Word e_flags)
480486
{ return (e_flags & elfcpp::EF_MIPS_ABI2) != 0; }
481487

488+
// Whether the ISA is R6.
489+
bool
490+
r6_isa(elfcpp::Elf_Word e_flags)
491+
{
492+
return ((e_flags & elfcpp::EF_MIPS_ARCH) == elfcpp::E_MIPS_ARCH_32R6)
493+
|| ((e_flags & elfcpp::EF_MIPS_ARCH) == elfcpp::E_MIPS_ARCH_64R6);
494+
}
495+
482496
// Whether the file has microMIPS code.
483497
bool
484498
is_micromips(elfcpp::Elf_Word e_flags)

‎gold/ChangeLog‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
2016-06-20 Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
2+
3+
* mips.cc (relocation_needs_la25_stub): Add support for relocs:
4+
R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
5+
(hi16_reloc): Add support for R_MIPS_PCHI16 relocation.
6+
(is_matching_lo16_reloc): Likewise.
7+
(lo16_reloc): Add support for R_MIPS_PCLO16 relocation.
8+
(Mips_output_data_plt::plt_entry_r6): New static data member for
9+
R6 PLT entry.
10+
(Target_mips::is_output_r6): New method.
11+
(Target_mips::Mips_mach): Add new enum constants.
12+
(Mips_relocate_functions::Status): Likewise.
13+
(Mips_relocate_functions::pchi16_relocs): New static data member.
14+
(Mips_relocate_functions::relpc21): New method.
15+
(Mips_relocate_functions::relpc26): Likewise.
16+
(Mips_relocate_functions::relpc18): Likewise.
17+
(Mips_relocate_functions::relpc19): Likewise.
18+
(Mips_relocate_functions::relpchi16): Likewise.
19+
(Mips_relocate_functions::do_relpchi16): Likewise.
20+
(Mips_relocate_functions::relpclo16): Likewise.
21+
(Mips_output_data_plt::do_write): Add support for Mips r6 plt
22+
entry.
23+
(Target_mips::mips_32bit_flags): Add E_MIPS_ARCH_32R6 support.
24+
(Target_mips::elf_mips_mach): Add E_MIPS_ARCH_32R6 and
25+
E_MIPS_ARCH_64R6 support.
26+
(Target_mips::update_abiflags_isa): Likewise.
27+
(mips_get_size_for_reloc): Add support for relocs: R_MIPS_PCHI16,
28+
R_MIPS_PCLO16, R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3 and
29+
R_MIPS_PC19_S2.
30+
(Target_mips::Scan::local): Add support for relocs: R_MIPS_PCHI16
31+
and R_MIPS_PCLO16.
32+
(Target_mips::Scan::global): Add support for relocs:
33+
R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
34+
(Target_mips::Relocate::relocate): Call functions for resolving
35+
Mips32r6 and Mips64r6 relocations, and print error message for
36+
STATUS_PCREL_UNALIGNED.
37+
(Target_mips::Scan::get_reference_flags): Add support for relocs:
38+
R_MIPS_PCHI16, R_MIPS_PCLO16, R_MIPS_PC21_S2, R_MIPS_PC26_S2,
39+
R_MIPS_PC18_S3 and R_MIPS_PC19_S2.
40+
(Target_mips::elf_mips_mach_name): Add E_MIPS_ARCH_32R6 and
41+
E_MIPS_ARCH_64R6 support.
42+
143
2016-06-13 H.J. Lu <hongjiu.lu@intel.com>
244

345
PR gold/20246

0 commit comments

Comments
 (0)