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

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 05:26:32 PDT 2020


nemanjai created this revision.
nemanjai added reviewers: MaskRay, luporl, hfinkel, PowerPC.
Herald added subscribers: shchenz, wuzish, kbarton, hiraditya.
Herald added a project: LLVM.

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

I will work on providing a test case, but I am posting here so the OP of the mentioned PR can try this out and perhaps generate a reproducer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78196

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


Index: llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
===================================================================
--- llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
+++ llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
@@ -210,6 +210,10 @@
     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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78196.257678.patch
Type: text/x-patch
Size: 552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/21b9d383/attachment.bin>


More information about the llvm-commits mailing list