[llvm] c196e2c - [PowerPC] Clear the set of symbols that need to be updated in MCTargetStreamer

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 13:42:42 PDT 2020


Author: Nemanja Ivanovic
Date: 2020-04-15T15:42:02-05:00
New Revision: c196e2ca48b739cae7d83e1ee0136f426f60aa53

URL: https://github.com/llvm/llvm-project/commit/c196e2ca48b739cae7d83e1ee0136f426f60aa53
DIFF: https://github.com/llvm/llvm-project/commit/c196e2ca48b739cae7d83e1ee0136f426f60aa53.diff

LOG: [PowerPC] Clear the set of symbols that need to be updated in MCTargetStreamer

We have added code to correct the .localentry values on assignments. However, we
never clear the set so presumably it will still contain the (now dangling)
MCSymbol pointers across a call to finish() and reset() in the streamer.

This is based on my speculation that it is the reason we are getting
segmentation faults mentioned in https://bugs.llvm.org/show_bug.cgi?id=45366

Fixes: https://bugs.llvm.org/show_bug.cgi?id=45366

Differential revision: https://reviews.llvm.org/D78196

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
index c85b08ad77e0..d8e1dd31b848 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
@@ -210,6 +210,10 @@ class PPCTargetELFStreamer : public PPCTargetStreamer {
     for (auto *Sym : UpdateOther)
       if (Sym->isVariable())
         copyLocalEntry(Sym, Sym->getVariableValue());
+
+    // Clear the set of symbols that needs to be updated so the streamer can
+    // be reused without issues.
+    UpdateOther.clear();
   }
 
 private:


        


More information about the llvm-commits mailing list