[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:12:23 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();
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D54762





More information about the llvm-commits mailing list