summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 96ebabeaba0..6087a2142cc 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -251,6 +251,13 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
Symtab.addIgnoredSym("_GLOBAL_OFFSET_TABLE_");
}
+ // Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
+ // so that it points to an absolute address which is relative to GOT.
+ // See "Global Data Symbols" in Chapter 6 in the following document:
+ // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
+ if (Config->EMachine == EM_MIPS)
+ Symtab.addAbsoluteSym("_gp", DefinedAbsolute<ELFT>::MipsGp);
+
for (std::unique_ptr<InputFile> &F : Files)
Symtab.addFile(std::move(F));
OpenPOWER on IntegriCloud