Simplify mips gp0 handling.
In all currently supported cases this is a nop.
llvm-svn: 266888
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index df846dd..8d276ec 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -630,8 +630,10 @@
if (!Config->Pic || Target->isRelRelative(Type) || Expr == R_PC ||
Expr == R_SIZE || isAbsolute<ELFT>(Body)) {
if (Config->EMachine == EM_MIPS && Body.isLocal() &&
- (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32))
- Expr = R_MIPS_GP0;
+ (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32)) {
+ Expr = R_ABS;
+ Addend += File.getMipsGp0();
+ }
C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
continue;
}