diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 247f48eb40f5..2fe4579fa222 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -1722,7 +1722,7 @@ void MipsTargetInfo::writeThunk(uint8_t *Buf, uint64_t S) const { template bool MipsTargetInfo::needsCopyRelImpl(uint32_t Type) const { - return !isRelRelative(Type); + return !isRelRelative(Type) || Type == R_MIPS_LO16; } template @@ -1897,7 +1897,6 @@ bool MipsTargetInfo::isRelRelative(uint32_t Type) const { case R_MIPS_32: case R_MIPS_64: case R_MIPS_HI16: - case R_MIPS_LO16: case R_MIPS_TLS_DTPREL_HI16: case R_MIPS_TLS_DTPREL_LO16: case R_MIPS_TLS_TPREL_HI16: diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index da5c3f8b359d..b814adfea30f 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -445,15 +445,6 @@ void Writer::scanRelocs(InputSectionBase &C, } if (Config->EMachine == EM_MIPS) { - if (Type == R_MIPS_LO16) - // Ignore R_MIPS_LO16 relocation. If it is a pair for R_MIPS_GOT16 we - // already completed all required action (GOT entry allocation) when - // handle R_MIPS_GOT16. If it is a pair for R_MIPS_HI16 against - // _gp_disp it does not require dynamic relocation. If its a pair for - // R_MIPS_HI16 against a regular symbol it does not require dynamic - // relocation too because that case is possible for executable file - // linking only. - continue; if (&Body == Config->MipsGpDisp || &Body == Config->MipsLocalGp) // MIPS _gp_disp designates offset between start of function and 'gp' // pointer into GOT. __gnu_local_gp is equal to the current value of