[llvm] [X86][Cygwin] Fix global variable dll import (PR #121439)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 1 08:29:43 PST 2025


================
@@ -204,7 +204,8 @@ bool TargetMachine::shouldAssumeDSOLocal(const GlobalValue *GV) const {
     // don't assume the variables to be DSO local unless we actually know
     // that for sure. This only has to be done for variables; for functions
     // the linker can insert thunks for calling functions from another DLL.
-    if (TT.isWindowsGNUEnvironment() && GV->isDeclarationForLinker() &&
+    if ((TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) &&
----------------
mstorsjo wrote:

There's a `isOSCygMing()` method in `Triple` which does this `isWindowsCygwinEnvironment() || isWindowsGNUEnvironment()` already.

Also, the subject mentions `[X86]`, but I don't really see anything X86 specific here (even if cygwin mainly is x86-only at the moment), so I'd suggest removing that part.

https://github.com/llvm/llvm-project/pull/121439


More information about the llvm-commits mailing list