Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-10-04 02:42:47 +0300
committerRui Ueyama <ruiu@google.com>2017-10-04 02:42:47 +0300
commita4fcc49a8b90d91781a8c627682832e89f606e7f (patch)
tree5adf8916dd48fbd697a4e5e97ec0a419b6f4e457
parent08d41dde7660a2e67efc84e626a819e2a093dcea (diff)
Merging r313741:
------------------------------------------------------------------------ r313741 | grimar | 2017-09-20 02:27:41 -0700 (Wed, 20 Sep 2017) | 9 lines [ELF] - Fix segfault when processing .eh_frame. Its a PR34648 which was a segfault that happened because we stored pointers to elements in DenseMap. When DenseMap grows such pointers are invalidated. Solution implemented is to keep elements by pointer and not by value. Differential revision: https://reviews.llvm.org/D38034 ------------------------------------------------------------------------ llvm-svn: 314860
-rw-r--r--lld/ELF/SyntheticSections.cpp5
-rw-r--r--lld/ELF/SyntheticSections.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 4bbec4ab34bd..5357ebca4bbe 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -427,10 +427,11 @@ CieRecord *EhFrameSection<ELFT>::addCie(EhSectionPiece &Piece,
&Sec->template getFile<ELFT>()->getRelocTargetSym(Rels[FirstRelI]);
// Search for an existing CIE by CIE contents/relocation target pair.
- CieRecord *Cie = &CieMap[{Piece.data(), Personality}];
+ CieRecord *&Cie = CieMap[{Piece.data(), Personality}];
// If not found, create a new one.
- if (Cie->Piece == nullptr) {
+ if (!Cie) {
+ Cie = make<CieRecord>();
Cie->Piece = &Piece;
Cies.push_back(Cie);
}
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index ddd8ca99a61b..ccf021ec9597 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -103,7 +103,8 @@ private:
std::vector<CieRecord *> Cies;
// CIE records are uniquified by their contents and personality functions.
- llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord> CieMap;
+ llvm::DenseMap<std::pair<ArrayRef<uint8_t>, SymbolBody *>, CieRecord *>
+ CieMap;
};
class GotSection : public SyntheticSection {