summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
diff options
context:
space:
mode:
authorYichao Yu <yyc1992@gmail.com>2017-10-26 17:36:43 +0000
committerYichao Yu <yyc1992@gmail.com>2017-10-26 17:36:43 +0000
commit221dae31a5e83aabfc5f7d2ef92d883147f35784 (patch)
treebc314c7d0f69458529bb4a9e331bb2041b9cc6c7 /llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
parent722693be246c2c5d85f22f858a0bc962ce032908 (diff)
downloadbcm5719-llvm-221dae31a5e83aabfc5f7d2ef92d883147f35784.tar.gz
bcm5719-llvm-221dae31a5e83aabfc5f7d2ef92d883147f35784.zip
Clear LastMappingSymbols and LastEMS(Info) when resetting the ARM(AArch64)ELFStreamer
Summary: This causes a segfault on ARM when (I think) the pass manager is used multiple times. Reset set the (last) current section to NULL without saving the corresponding LastEMSInfo back into the map. The next use of the streamer then save the LastEMSInfo for the NULL section leaving the LastEMSInfo mapping for the last current section (the one that was there before the reset) NULL which cause the LastEMSInfo to be set to NULL when the section is being used again. The reuse of the section (pointer) might mean that the map was holding dangling pointers previously which is why I went for clearing the map and resetting the info, making it as similar to the state right after the constructor run as possible. The AArch64 one doesn't have segfault (since LastEMS isn't a pointer) but it seems to have the same issue. The segfault is likely caused by https://reviews.llvm.org/D30724 which turns LastEMSInfo into a pointer. As mentioned above, it seems that the actual issue was older though. No test is included since the test is believed to be too complicated for such an obvious fix and not worth doing. Reviewers: llvm-commits, shankare, t.p.northover, peter.smith, rengolin Reviewed By: rengolin Subscribers: mgorny, aemerson, rengolin, javed.absar, kristof.beyls Differential Revision: https://reviews.llvm.org/D38588 llvm-svn: 316679
Diffstat (limited to 'llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp')
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index 1f995ddba7d..8cfa18f58b6 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -1171,6 +1171,8 @@ void ARMELFStreamer::reset() {
ATS.reset();
MappingSymbolCounter = 0;
MCELFStreamer::reset();
+ LastMappingSymbols.clear();
+ LastEMSInfo.reset();
// MCELFStreamer clear's the assembler's e_flags. However, for
// arm we manually set the ABI version on streamer creation, so
// do the same here
OpenPOWER on IntegriCloud