[PATCH] D48402: [mingw] Fix GCC ABI compatibility for comdat things

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 15:51:31 PDT 2018


rnk created this revision.
rnk added reviewers: smeenai, compnerd, mstorsjo, martell, mati865.
Herald added a subscriber: hiraditya.

GCC and the binutils COFF linker do comdats differently from MSVC.
If we want to be ABI compatible, we have to do what they do, which is to
emit unique section names like ".text$_Z3foov" instead of short section
names like ".text". Otherwise, the binutils linker gets confused and
reports multiple definition errors when two object files from GCC and
Clang containing the same inline function are linked together.

The best description of the issue is probably at
https://github.com/Alexpux/MINGW-packages/issues/1677, we don't seem to
have a good one in our tracker.

I fixed up the .pdata and .xdata sections needed everywhere other than
32-bit x86. GCC doesn't use associative comdats for those, it appears to
rely on the section name.


https://reviews.llvm.org/D48402

Files:
  llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
  llvm/include/llvm/MC/MCAsmInfo.h
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/MC/MCAsmInfoCOFF.cpp
  llvm/lib/MC/MCStreamer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48402.152188.patch
Type: text/x-patch
Size: 7175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180620/7fe09fda/attachment.bin>


More information about the llvm-commits mailing list