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)
commit013321a0f9e9f784ebb9a78ebf19e5f5099d5b16
tree753bc6d742f12a5bb5f04d59afe902c14caba635
parent5448320a2061faeadedc800dff9a9adf14005a72
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210367 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
docs/Extensions.rst
include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
include/llvm/MC/MCContext.h
include/llvm/MC/MCSectionCOFF.h
include/llvm/Target/TargetLoweringObjectFile.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
lib/MC/MCContext.cpp
lib/MC/MCParser/COFFAsmParser.cpp
lib/MC/MCSectionCOFF.cpp
lib/MC/WinCOFFObjectWriter.cpp
test/MC/COFF/global_ctors_dtors.ll
test/MC/COFF/linkonce-invalid.s
test/MC/COFF/linkonce.s
test/MC/COFF/section-comdat-conflict.s [new file with mode: 0644]
test/MC/COFF/section-comdat-conflict2.s [new file with mode: 0644]
test/MC/COFF/section-comdat.s