aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSectionCOFF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-06 19:26:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-06 19:26:12 +0000
commit0766ae08e58cb6358ed1ce407439bd3614380b2e (patch)
tree9fb6cc7e47d0425023153d376f61fd96a090146d /llvm/lib/MC/MCSectionCOFF.cpp
parent0dd8d486b395436059f828fdf4913b43006dc905 (diff)
downloadllvm-0766ae08e58cb6358ed1ce407439bd3614380b2e.zip
llvm-0766ae08e58cb6358ed1ce407439bd3614380b2e.tar.gz
llvm-0766ae08e58cb6358ed1ce407439bd3614380b2e.tar.bz2
Fix a few issues with comdat handling on COFF.
* Section association cannot use just the section name as many sections can have the same name. With this patch, the comdat symbol in an assoc section is interpreted to mean a symbol in the associated section and the mapping is discovered from it. * Comdat symbols were not being set correctly. Instead we were getting whatever was output first for that section. A consequence is that associative sections now must use .section to set the association. Using .linkonce would not work since it is not possible to change a sections comdat symbol (it is used to decide if we should create a new section or reuse an existing one). This includes r210298, which was reverted because it was asserting on an associated section having the same comdat as the associated section. llvm-svn: 210367
Diffstat (limited to 'llvm/lib/MC/MCSectionCOFF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionCOFF.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCSectionCOFF.cpp b/llvm/lib/MC/MCSectionCOFF.cpp
index 335b8cd..fc2bd36 100644
--- a/llvm/lib/MC/MCSectionCOFF.cpp
+++ b/llvm/lib/MC/MCSectionCOFF.cpp
@@ -30,14 +30,9 @@ bool MCSectionCOFF::ShouldOmitSectionDirective(StringRef Name,
return false;
}
-void MCSectionCOFF::setSelection(int Selection,
- const MCSectionCOFF *Assoc) const {
+void MCSectionCOFF::setSelection(int Selection) const {
assert(Selection != 0 && "invalid COMDAT selection type");
- assert((Selection == COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE) ==
- (Assoc != nullptr) &&
- "associative COMDAT section must have an associated section");
this->Selection = Selection;
- this->Assoc = Assoc;
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
}
@@ -82,7 +77,7 @@ void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
OS << "same_contents,";
break;
case COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE:
- OS << "associative " << Assoc->getSectionName() << ",";
+ OS << "associative,";
break;
case COFF::IMAGE_COMDAT_SELECT_LARGEST:
OS << "largest,";