[PATCH] D38034: [ELF] - Fix segfault when processing .eh_frame.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 02:29:21 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL313741: [ELF] - Fix segfault when processing .eh_frame. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D38034?vs=115829&id=115976#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38034

Files:
  lld/trunk/ELF/SyntheticSections.cpp
  lld/trunk/ELF/SyntheticSections.h


Index: lld/trunk/ELF/SyntheticSections.cpp
===================================================================
--- lld/trunk/ELF/SyntheticSections.cpp
+++ lld/trunk/ELF/SyntheticSections.cpp
@@ -417,10 +417,11 @@
         &Sec->template getFile<ELFT>()->getRelocTargetSym(Rels[FirstRelI]);
 
   // Search for an existing CIE by CIE contents/relocation target pair.
-  CieRecord *Rec = &CieMap[{Cie.data(), Personality}];
+  CieRecord *&Rec = CieMap[{Cie.data(), Personality}];
 
   // If not found, create a new one.
-  if (Rec->Cie == nullptr) {
+  if (!Rec) {
+    Rec = make<CieRecord>();
     Rec->Cie = &Cie;
     CieRecords.push_back(Rec);
   }
Index: lld/trunk/ELF/SyntheticSections.h
===================================================================
--- lld/trunk/ELF/SyntheticSections.h
+++ lld/trunk/ELF/SyntheticSections.h
@@ -103,7 +103,8 @@
   std::vector<CieRecord *> CieRecords;
 
   // 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38034.115976.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170920/ac54cad1/attachment.bin>


More information about the llvm-commits mailing list