Correctly set the comdat symbol on COFF.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 5 Jun 2014 23:09:25 +0000 (23:09 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 5 Jun 2014 23:09:25 +0000 (23:09 +0000)
commitd605148d07288ba70bb949110d4036caf85de395
treefc901b8db204b5d68ebc2bb80551a0df1a93b94a
parent5f81752533b4e352fae1133c790b0fe67a7a1c84
Correctly set the comdat symbol on COFF.

We extended the .section syntax to allow multiple sections with the
same name but different comdats, but currently we don't make sure that
the output section has that comdat symbol.

That happens to work with the code llc produces currently because it looks like

.section secName, "dr", one_only, "COMDATSym"
.globl COMDATSym
COMDATSym:
....

but that is not very friendly to anyone coding in assembly or even to
llc once we get comdat support in the IR.

This patch changes the coff object writer to make sure the comdat symbol is
output just after the section symbol, as required by the coff spec.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210298 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCSectionCOFF.h
lib/MC/WinCOFFObjectWriter.cpp
test/MC/COFF/section-comdat-conflict.s [new file with mode: 0644]
test/MC/COFF/section-comdat.s