[llvm] [X86][Cygwin] Fix global variable dll import (PR #121439)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 1 08:04:38 PST 2025
https://github.com/Berrysoft created https://github.com/llvm/llvm-project/pull/121439
This PR is necessary for cygwin target of Rust.
References:
* https://github.com/rust-lang/llvm-project/commit/86657cc39f8e42ae73be810fb0703ddac0eeef94#diff-3bca112ea89464b3108c654a94adb7869c0b7ee023c4d95b935bae0c9f56cd77
* https://github.com/Berrysoft/llvm-project/commit/a807e9f077351d3c6a68f4abe74c94a039759a2e
>From 5062f771c083054105a9ea6cb0c7025c5f9cc5c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= <Strawberry_Str at hotmail.com>
Date: Thu, 2 Jan 2025 00:59:07 +0900
Subject: [PATCH] [X86][Cygwin] Fix global variable dll import
---
llvm/lib/Target/TargetMachine.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index c0985f3be91a53..9f095f1a8cbeb6 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -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()) &&
+ GV->isDeclarationForLinker() &&
isa<GlobalVariable>(GV))
return false;
More information about the llvm-commits
mailing list