summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2016-02-25 16:19:15 +0000
committerSimon Atanasyan <simon@atanasyan.com>2016-02-25 16:19:15 +0000
commitd040a58da371bd177a26409d9cc50de33ed0b654 (patch)
tree6dcc2156a6fe6e80527945a6cc4ecb5776e4c997 /lld/ELF/OutputSections.cpp
parent161a158e5c497a54ea0ba588d242fa98e7c0a3e8 (diff)
downloadbcm5719-llvm-d040a58da371bd177a26409d9cc50de33ed0b654.tar.gz
bcm5719-llvm-d040a58da371bd177a26409d9cc50de33ed0b654.zip
[ELF][MIPS] Add STO_MIPS_PLT flag to the symbols require pointer equality
On MIPS we need to mark symbol which has a PLT entry and requires pointer equality by STO_MIPS_PLT flag. That is necessary to help dynamic linker distinguish such symbols and MIPS lazy-binding stubs. https://sourceware.org/ml/binutils/2008-07/txt00000.txt Differential Revision: http://reviews.llvm.org/D17593 llvm-svn: 261879
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r--lld/ELF/OutputSections.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index d7047b0b720..b2a676a6fc5 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -1509,6 +1509,14 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
ESym->st_shndx = OutSec->SectionIndex;
else if (isa<DefinedRegular<ELFT>>(Body))
ESym->st_shndx = SHN_ABS;
+
+ // On MIPS we need to mark symbol which has a PLT entry and requires pointer
+ // equality by STO_MIPS_PLT flag. That is necessary to help dynamic linker
+ // distinguish such symbols and MIPS lazy-binding stubs.
+ // https://sourceware.org/ml/binutils/2008-07/txt00000.txt
+ if (Config->EMachine == EM_MIPS && Body->isInPlt() &&
+ Body->NeedsCopyOrPltAddr)
+ ESym->st_other |= ELF::STO_MIPS_PLT;
++ESym;
}
}
OpenPOWER on IntegriCloud