diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-06 19:26:12 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-06 19:26:12 +0000 |
commit | 0766ae08e58cb6358ed1ce407439bd3614380b2e (patch) | |
tree | 9fb6cc7e47d0425023153d376f61fd96a090146d /llvm/lib/MC/MCContext.cpp | |
parent | 0dd8d486b395436059f828fdf4913b43006dc905 (diff) | |
download | bcm5719-llvm-0766ae08e58cb6358ed1ce407439bd3614380b2e.tar.gz bcm5719-llvm-0766ae08e58cb6358ed1ce407439bd3614380b2e.zip |
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/MCContext.cpp')
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index c16326829d8..130bb99f98b 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -277,10 +277,11 @@ const MCSectionELF *MCContext::CreateELFGroupSection() { return Result; } -const MCSectionCOFF * -MCContext::getCOFFSection(StringRef Section, unsigned Characteristics, - SectionKind Kind, StringRef COMDATSymName, - int Selection, const MCSectionCOFF *Assoc) { +const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section, + unsigned Characteristics, + SectionKind Kind, + StringRef COMDATSymName, + int Selection) { // Do the lookup, if we have a hit, return it. SectionGroupPair P(Section, COMDATSymName); @@ -294,8 +295,8 @@ MCContext::getCOFFSection(StringRef Section, unsigned Characteristics, COMDATSymbol = GetOrCreateSymbol(COMDATSymName); StringRef CachedName = Iter->first.first; - MCSectionCOFF *Result = new (*this) MCSectionCOFF( - CachedName, Characteristics, COMDATSymbol, Selection, Assoc, Kind); + MCSectionCOFF *Result = new (*this) + MCSectionCOFF(CachedName, Characteristics, COMDATSymbol, Selection, Kind); Iter->second = Result; return Result; |