From d1c6b5de4e7f33436c455fd5f38d481999e39419 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 17 Aug 2009 17:05:44 +0000 Subject: [PATCH] Clear the uniquing table when initializing TLOF to avoid a crash when the TLOF is reinitialized with a different MCContext. llvm-svn: 79253 --- lib/Target/TargetLoweringObjectFile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 8e1351bc065..ff0180bc0f9 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -304,6 +304,8 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags, void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx, const TargetMachine &TM) { + if (UniquingMap != 0) + ((ELFUniqueMapTy*)UniquingMap)->clear(); TargetLoweringObjectFile::Initialize(Ctx, TM); BSSSection = @@ -666,6 +668,8 @@ getMachOSection(const StringRef &Segment, const StringRef &Section, void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx, const TargetMachine &TM) { + if (UniquingMap != 0) + ((MachOUniqueMapTy*)UniquingMap)->clear(); TargetLoweringObjectFile::Initialize(Ctx, TM); TextSection // .text @@ -946,6 +950,8 @@ getCOFFSection(const char *Name, bool isDirective, SectionKind Kind) const { void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx, const TargetMachine &TM) { + if (UniquingMap != 0) + ((COFFUniqueMapTy*)UniquingMap)->clear(); TargetLoweringObjectFile::Initialize(Ctx, TM); TextSection = getCOFFSection("\t.text", true, SectionKind::getText()); DataSection = getCOFFSection("\t.data", true, SectionKind::getDataRel());