Skip to content

Commit

Permalink
[Cygwin] Fix global variable dll import (llvm#121439)
Browse files Browse the repository at this point in the history
This PR is necessary for cygwin target of Rust.

References:
*
rust-lang@86657cc
*
Berrysoft@a807e9f
  • Loading branch information
Berrysoft authored Jan 2, 2025
1 parent 4922350 commit f03b100
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/Target/TargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ 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.isOSCygMing() && GV->isDeclarationForLinker() &&
isa<GlobalVariable>(GV))
return false;

Expand Down
1 change: 1 addition & 0 deletions llvm/test/CodeGen/X86/mingw-refptr.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: llc < %s -mtriple=x86_64-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X64
; RUN: llc < %s -mtriple=x86_64-pc-cygwin | FileCheck %s -check-prefix=CHECK-X64
; RUN: llc < %s -mtriple=i686-w64-mingw32 | FileCheck %s -check-prefix=CHECK-X86
; RUN: llc < %s -mtriple=i686-w64-mingw32-none-elf | FileCheck %s -check-prefix=CHECK-X86-ELF

Expand Down

0 comments on commit f03b100

Please sign in to comment.