[PATCH] D54762: i686 mingw-w64 comdat functions use wrong .text section name
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 21 13:47:03 PST 2018
rnk added inline comments.
================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1318-1324
StringRef COMDATSymName = Sym->getName();
// Append "$symbol" to the section name when targetting mingw. The ld.bfd
// COFF linker will not properly handle comdats otherwise.
- if (getTargetTriple().isWindowsGNUEnvironment())
- raw_svector_ostream(Name) << '$' << COMDATSymName;
+ if (getTargetTriple().isWindowsGNUEnvironment()) {
+ if (getTargetTriple().isArch32Bit()) {
+ raw_svector_ostream(Name) << '$' << GO->getComdat()->getName();
----------------
mstorsjo wrote:
> rnk wrote:
> > I think this needs a bit of massaging. I don't think we want to check for `isArch32Bit`, we should just always use the name of the comdat if it's available. However, `GO->getComdat()` may return null, and this code should fall back to getting the IR name of the global in that case. I'll try to put something together for this later today.
> Also, when it comes to "weird name mangling" on windows, the differentiator isn't usually whether it is 32 bit, but i386 alone has got the weird cases, 32 bit arm is just as simple/straightforward as x86_64 and arm64 when it comes to name mangling.
Does this seem correct, @mstorsjo?
https://reviews.llvm.org/D54762
More information about the llvm-commits
mailing list