Fix a few issues with comdat handling on COFF.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 6 Jun 2014 19:26:12 +0000 (19:26 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 6 Jun 2014 19:26:12 +0000 (19:26 +0000)
commit0766ae08e58cb6358ed1ce407439bd3614380b2e
tree9fb6cc7e47d0425023153d376f61fd96a090146d
parent0dd8d486b395436059f828fdf4913b43006dc905
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
17 files changed:
llvm/docs/Extensions.rst
llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
llvm/include/llvm/MC/MCContext.h
llvm/include/llvm/MC/MCSectionCOFF.h
llvm/include/llvm/Target/TargetLoweringObjectFile.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCParser/COFFAsmParser.cpp
llvm/lib/MC/MCSectionCOFF.cpp
llvm/lib/MC/WinCOFFObjectWriter.cpp
llvm/test/MC/COFF/global_ctors_dtors.ll
llvm/test/MC/COFF/linkonce-invalid.s
llvm/test/MC/COFF/linkonce.s
llvm/test/MC/COFF/section-comdat-conflict.s [new file with mode: 0644]
llvm/test/MC/COFF/section-comdat-conflict2.s [new file with mode: 0644]
llvm/test/MC/COFF/section-comdat.s