Skip to content

Commit 22eb11c

Browse files
committed
auto merge of #10227 : kud1ing/rust/ios, r=alexcrichton
2 parents fdc830d + 2a333ed commit 22eb11c

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

mk/platform.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2))
195195

196196
# arm-apple-darwin configuration
197197
ifeq ($(CFG_OSTYPE),apple-darwin)
198-
CFG_IOS_SDK = $(shell xcrun --show-sdk-path -sdk iphoneos)
199-
CFG_IOS_FLAGS = -target arm-apple-darwin -isysroot $(CFG_IOS_SDK) -I $(CFG_IOS_SDK)/usr/include -I $(CFG_IOS_SDK)/usr/include/c++/4.2.1 -I /usr/include
198+
CFG_IOS_SDK = $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
199+
CFG_IOS_FLAGS = -target arm-apple-darwin -isysroot $(CFG_IOS_SDK) -I$(CFG_IOS_SDK)/usr/include -I$(CFG_IOS_SDK)/usr/include/c++/4.2.1
200200
CC_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos clang)
201201
CXX_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos clang++)
202202
CPP_arm-apple-darwin = $(shell xcrun -find -sdk iphoneos clang++)

mk/rt.mk

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ 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
31+
else ifeq ($(OSTYPE_$(1)), apple-darwin)
32+
ifeq ($(HOST_$(1)), arm)
33+
IOS_SDK := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
34+
LIBUV_FLAGS_arm := -fPIC -std=gnu99 -I$(IOS_SDK)/usr/include -I$(IOS_SDK)/usr/include/c++/4.2.1
35+
else
36+
LIBUV_FLAGS_arm := -fPIC -std=gnu99
37+
endif
3138
else
3239
LIBUV_FLAGS_arm = -fPIC -std=gnu99
3340
endif

src/rt/arch/arm/_context.S

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
.text
77
.code 32
88
.arm
9+
#if defined(__APPLE__)
10+
.align 2
11+
#else
912
.align
10-
13+
#endif
1114

1215
.globl swap_registers
1316
swap_registers:

src/rt/arch/arm/record_sp.S

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
.text
77
.code 32
88
.arm
9+
#if defined(__APPLE__)
10+
.align 2
11+
#else
912
.align
10-
13+
#endif
1114

1215
.globl record_sp_limit
1316
.globl get_sp_limit

src/rt/rust_builtin.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@
1717
#include <time.h>
1818

1919
#ifdef __APPLE__
20-
#include <crt_externs.h>
21-
#include <mach/mach_time.h>
20+
#include <TargetConditionals.h>
21+
#include <mach/mach_time.h>
22+
23+
#if (TARGET_OS_IPHONE)
24+
extern char **environ;
25+
#else
26+
#include <crt_externs.h>
27+
#endif
2228
#endif
2329

2430
#if !defined(__WIN32__)
@@ -57,7 +63,7 @@ rust_env_pairs() {
5763
#else
5864
extern "C" CDECL char**
5965
rust_env_pairs() {
60-
#ifdef __APPLE__
66+
#if defined(__APPLE__) && !(TARGET_OS_IPHONE)
6167
char **environ = *_NSGetEnviron();
6268
#endif
6369
return environ;

0 commit comments

Comments
 (0)