Skip to content

Commit adb638f

Browse files
committed
auto merge of #9254 : vadimcn/rust/fix-mingw-v4, r=brson
Fix Rust build on mingw v4.0 See #9246 for details.
2 parents 7dd9344 + e6832e6 commit adb638f

11 files changed

+44
-3
lines changed

mk/llvm.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
2828

2929
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
3030
@$$(call E, make: llvm)
31-
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV)
31+
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) $$(CFG_LLVM_BUILD_ENV_$(1))
3232
$$(Q)touch $$(LLVM_CONFIG_$(1))
3333
endif
3434

mk/platform.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ AR_i686-pc-mingw32=$(AR)
352352
CFG_LIB_NAME_i686-pc-mingw32=$(1).dll
353353
CFG_LIB_GLOB_i686-pc-mingw32=$(1)-*.dll
354354
CFG_LIB_DSYM_GLOB_i686-pc-mingw32=$(1)-*.dylib.dSYM
355-
CFG_GCCISH_CFLAGS_i686-pc-mingw32 := -Wall -Werror -g -m32 -march=i686 -D_WIN32_WINNT=0x0600
355+
CFG_GCCISH_CFLAGS_i686-pc-mingw32 := -Wall -Werror -g -m32 -march=i686 -D_WIN32_WINNT=0x0600 -I$(CFG_SRC_DIR)src/etc/mingw-fix-include
356356
CFG_GCCISH_CXXFLAGS_i686-pc-mingw32 := -fno-rtti
357357
CFG_GCCISH_LINK_FLAGS_i686-pc-mingw32 := -shared -fPIC -g -m32
358358
CFG_GCCISH_DEF_FLAG_i686-pc-mingw32 :=
@@ -361,6 +361,7 @@ CFG_GCCISH_POST_LIB_FLAGS_i686-pc-mingw32 :=
361361
CFG_DEF_SUFFIX_i686-pc-mingw32 := .mingw32.def
362362
CFG_INSTALL_NAME_i686-pc-mingw32 =
363363
CFG_LIBUV_LINK_FLAGS_i686-pc-mingw32 := -lWs2_32 -lpsapi -liphlpapi
364+
CFG_LLVM_BUILD_ENV_i686-pc-mingw32 := CPATH=$(CFG_SRC_DIR)src/etc/mingw-fix-include
364365
CFG_EXE_SUFFIX_i686-pc-mingw32 := .exe
365366
CFG_WINDOWSY_i686-pc-mingw32 := 1
366367
CFG_UNIXY_i686-pc-mingw32 :=

mk/rt.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# working under these assumptions).
2525

2626
# Hack for passing flags into LIBUV, see below.
27-
LIBUV_FLAGS_i386 = -m32 -fPIC
27+
LIBUV_FLAGS_i386 = -m32 -fPIC -I$(S)src/etc/mingw-fix-include
2828
LIBUV_FLAGS_x86_64 = -m64 -fPIC
2929
ifeq ($(OSTYPE_$(1)), linux-androideabi)
3030
LIBUV_FLAGS_arm = -fPIC -DANDROID -std=gnu99

src/etc/mingw-fix-include/README.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The purpose of these headers is to fix issues with mingw v4.0, as described in #9246.
2+
3+
This works by adding this directory to GCC include search path before mingw system headers directories,
4+
so we can intercept their inclusions and add missing definitions without having to modify files in mingw/include.
5+
6+
Once mingw fixes all 3 issues mentioned in #9246, this directory and all references to it from rust/mk/* may be removed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _FIX_CXXCONFIG_H
2+
#define _FIX_CXXCONFIG_H 1
3+
4+
#define _GLIBCXX_HAVE_FENV_H 1
5+
6+
#include_next <bits/c++config.h>
7+
8+
#endif

src/etc/mingw-fix-include/winbase.h

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _FIX_WINBASE_H
2+
#define _FIX_WINBASE_H 1
3+
4+
#define NTDDK_VERSION NTDDI_VERSION
5+
6+
#include_next <winbase.h>
7+
8+
#endif

src/etc/mingw-fix-include/winsock2.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef _FIX_WINSOCK2_H
2+
#define _FIX_WINSOCK2_H 1
3+
4+
#include_next <winsock2.h>
5+
6+
typedef struct pollfd {
7+
SOCKET fd;
8+
short events;
9+
short revents;
10+
} WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD;
11+
12+
#endif

src/test/run-pass/extern-pass-TwoU64s-ref.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// Test that we ignore modes when calling extern functions.
12+
// xfail-fast #9205
1213

1314
#[deriving(Eq)]
1415
struct TwoU64s {

src/test/run-pass/extern-pass-TwoU64s.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// xfail-fast This works standalone on windows but not with check-fast.
1515
// possibly because there is another test that uses this extern fn but gives it
1616
// a different signature
17+
// xfail-fast #9205
1718

1819
#[deriving(Eq)]
1920
struct TwoU64s {

src/test/run-pass/extern-return-TwoU64s.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// xfail-fast #9205
12+
1113
struct TwoU64s {
1214
one: u64, two: u64
1315
}

src/test/run-pass/struct-return.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// xfail-fast #9205
12+
1113
pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
1214
pub struct Floats { a: f64, b: u8, c: f64 }
1315

0 commit comments

Comments
 (0)