diff options
author | Reid Kleckner <rnk@google.com> | 2018-11-21 22:01:10 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-11-21 22:01:10 +0000 |
commit | 86ada54e4ce212d3cd350139c0712f71ac7ee5ea (patch) | |
tree | 10a3f257f6a9709586ec4bd16ede1e8031362477 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | fd6a8abd08feb09de22091399e4685d675b0b3b9 (diff) | |
download | llvm-86ada54e4ce212d3cd350139c0712f71ac7ee5ea.zip llvm-86ada54e4ce212d3cd350139c0712f71ac7ee5ea.tar.gz llvm-86ada54e4ce212d3cd350139c0712f71ac7ee5ea.tar.bz2 |
[mingw] Use unmangled name after the $ in the section name
GCC does it this way, and we have to be consistent. This includes
stdcall and fastcall functions with suffixes. I confirmed that a
fastcall function named "foo" ends up in ".text$foo", not
".text$@foo@8".
Based on a patch by Andrew Yohn!
Fixes PR39218.
Differential Revision: https://reviews.llvm.org/D54762
llvm-svn: 347431
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 341ab92..5f4421f 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1317,10 +1317,11 @@ MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal( MCSymbol *Sym = TM.getSymbol(ComdatGV); StringRef COMDATSymName = Sym->getName(); - // Append "$symbol" to the section name when targetting mingw. The ld.bfd + // Append "$symbol" to the section name *before* IR-level mangling is + // applied when targetting mingw. This is what GCC does, and the ld.bfd // COFF linker will not properly handle comdats otherwise. if (getTargetTriple().isWindowsGNUEnvironment()) - raw_svector_ostream(Name) << '$' << COMDATSymName; + raw_svector_ostream(Name) << '$' << ComdatGV->getName(); return getContext().getCOFFSection(Name, Characteristics, Kind, COMDATSymName, Selection, UniqueID); |