Skip to content

Commit f03b100

Browse files
authored
[Cygwin] Fix global variable dll import (#121439)
This PR is necessary for cygwin target of Rust. References: * rust-lang@86657cc * Berrysoft@a807e9f
1 parent 4922350 commit f03b100

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/Target/TargetMachine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ bool TargetMachine::shouldAssumeDSOLocal(const GlobalValue *GV) const {
204204
// don't assume the variables to be DSO local unless we actually know
205205
// that for sure. This only has to be done for variables; for functions
206206
// the linker can insert thunks for calling functions from another DLL.
207-
if (TT.isWindowsGNUEnvironment() && GV->isDeclarationForLinker() &&
207+
if (TT.isOSCygMing() && GV->isDeclarationForLinker() &&
208208
isa<GlobalVariable>(GV))
209209
return false;
210210

llvm/test/CodeGen/X86/mingw-refptr.ll

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s -mtriple=x86_64-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X64
2+
; RUN: llc < %s -mtriple=x86_64-pc-cygwin | FileCheck %s -check-prefix=CHECK-X64
23
; RUN: llc < %s -mtriple=i686-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X86
34
; RUN: llc < %s -mtriple=i686-w64-mingw32-none-elf | FileCheck %s -check-prefix=CHECK-X86-ELF
45

0 commit comments

Comments
 (0)