Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows patches for LLVM 3.9 #19138

Merged
merged 7 commits into from
Dec 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion deps/Versions.make
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
LLVM_VER = 3.7.1
LLVM_LIB_SUFFIX =
PCRE_VER = 10.22
DSFMT_VER = 2.2.3
LAPACK_VER = 3.5.0
Expand Down
8 changes: 8 additions & 0 deletions deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ LLVM_FLAGS += --disable-assertions
endif # LLVM_ASSERTIONS
ifeq ($(LLVM_DEBUG), 1)
LLVM_FLAGS += --disable-optimized --enable-debug-symbols --enable-keep-symbols
ifeq ($(OS), WINNT)
LLVM_CXXFLAGS += -Wa,-mbig-obj
endif # OS == WINNT
else
LLVM_FLAGS += --enable-optimized
endif # LLVM_DEBUG
Expand Down Expand Up @@ -478,6 +481,11 @@ $(eval $(call LLVM_PATCH,llvm-PR22923)) # Remove for 4.0
$(eval $(call LLVM_PATCH,llvm-r282182)) # Remove for 4.0
$(eval $(call LLVM_PATCH,llvm-arm-fix-prel31))
$(eval $(call LLVM_PATCH,llvm-D25865-cmakeshlib))
# Cygwin and openSUSE still use win32-threads mingw, https://llvm.org/bugs/show_bug.cgi?id=26365
$(eval $(call LLVM_PATCH,llvm-3.9.0_threads))
$(eval $(call LLVM_PATCH,llvm-3.9.0_cygwin)) # R283427, Remove for 4.0
$(eval $(call LLVM_PATCH,llvm-3.9.0_win64-reloc-dwarf))
$(eval $(call LLVM_PATCH,llvm-3.9.0_D27296-libssp))
endif # LLVM_VER

ifeq ($(LLVM_VER),3.7.1)
Expand Down
47 changes: 47 additions & 0 deletions deps/patches/llvm-3.9.0_D27296-libssp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From e95516f77127ca534775d5f8d8cbb6e2e9c3f993 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <[email protected]>
Date: Thu, 1 Dec 2016 18:48:30 +0900
Subject: [PATCH] Don't assume mingw is providing SSP functions

Summary:
Mingw is indirectly targeting msvcrt*.dll and we can't guarantee that
these functions will be available during JIT'ing.

Differential Revision: https://reviews.llvm.org/D27296
---
lib/Target/X86/X86ISelLowering.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 44eae35..a932792 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -2016,7 +2016,7 @@ Value *X86TargetLowering::getIRStackGuard(IRBuilder<> &IRB) const {

void X86TargetLowering::insertSSPDeclarations(Module &M) const {
// MSVC CRT provides functionalities for stack protection.
- if (Subtarget.getTargetTriple().isOSMSVCRT()) {
+ if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment()) {
// MSVC CRT has a global variable holding security cookie.
M.getOrInsertGlobal("__security_cookie",
Type::getInt8PtrTy(M.getContext()));
@@ -2038,14 +2038,14 @@ void X86TargetLowering::insertSSPDeclarations(Module &M) const {

Value *X86TargetLowering::getSDagStackGuard(const Module &M) const {
// MSVC CRT has a global variable holding security cookie.
- if (Subtarget.getTargetTriple().isOSMSVCRT())
+ if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment())
return M.getGlobalVariable("__security_cookie");
return TargetLowering::getSDagStackGuard(M);
}

Value *X86TargetLowering::getSSPStackGuardCheck(const Module &M) const {
// MSVC CRT has a function to validate security cookie.
- if (Subtarget.getTargetTriple().isOSMSVCRT())
+ if (Subtarget.getTargetTriple().isWindowsMSVCEnvironment())
return M.getFunction("__security_check_cookie");
return TargetLowering::getSSPStackGuardCheck(M);
}
--
2.10.2

23 changes: 23 additions & 0 deletions deps/patches/llvm-3.9.0_cygwin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 9f7957830512dbcddd9cb5542080eb2d1cdd705b Mon Sep 17 00:00:00 2001
From: Nuno Lopes <[email protected]>
Date: Thu, 6 Oct 2016 09:32:16 +0000
Subject: [PATCH] fix build on cygwin Cygwin has dlfcn.h, but no Dl_info

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283427 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/Support/Unix/Signals.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
index 46b640a..9752b70 100644
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -412,7 +412,7 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS) {

if (printSymbolizedStackTrace(Argv0, StackTrace, depth, OS))
return;
-#if HAVE_DLFCN_H && __GNUG__
+#if HAVE_DLFCN_H && __GNUG__ && !defined(__CYGWIN__)
int width = 0;
for (int i = 0; i < depth; ++i) {
Dl_info dlinfo;
Loading