Skip to content

Commit 366de83

Browse files
authored
Auto merge of #34519 - alexcrichton:fix-nightlies, r=brson
Try to fix the nightlies They look to be failing right after the CMake PR landed. I've diagnosed and confirmed the first issue fixed, the second is a bit of a shot in the dark to see if it fixes things.
2 parents 59152a4 + 3fd411e commit 366de83

File tree

2 files changed

+59
-24
lines changed

2 files changed

+59
-24
lines changed

mk/llvm.mk

+13-1
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@ endif
2727

2828
define DEF_LLVM_RULES
2929

30+
ifeq ($(1),$$(CFG_BUILD))
31+
LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS)
32+
else
33+
LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
34+
endif
35+
3036
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
3137
ifeq ($(CFG_LLVM_ROOT),)
3238

3339
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
3440

35-
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
41+
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
3642
@$$(call E, cmake: llvm)
3743
ifeq ($$(findstring msvc,$(1)),msvc)
3844
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
@@ -42,7 +48,13 @@ else
4248
endif
4349
$$(Q)touch $$(LLVM_CONFIG_$(1))
4450

51+
ifeq ($$(findstring msvc,$(1)),msvc)
4552
clean-llvm$(1):
53+
else
54+
clean-llvm$(1):
55+
@$$(call E, clean: llvm)
56+
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
57+
endif
4658

4759
else
4860
clean-llvm$(1):

src/bootstrap/build/native.rs

+46-23
Original file line numberDiff line numberDiff line change
@@ -135,27 +135,64 @@ pub fn compiler_rt(build: &Build, target: &str) {
135135
let dst = build.compiler_rt_out(target);
136136
let arch = target.split('-').next().unwrap();
137137
let mode = if build.config.rust_optimize {"Release"} else {"Debug"};
138+
139+
let build_llvm_config = build.llvm_config(&build.config.build);
140+
let mut cfg = cmake::Config::new(build.src.join("src/compiler-rt"));
141+
cfg.target(target)
142+
.host(&build.config.build)
143+
.out_dir(&dst)
144+
.profile(mode)
145+
.define("LLVM_CONFIG_PATH", build_llvm_config)
146+
.define("COMPILER_RT_DEFAULT_TARGET_TRIPLE", target)
147+
.define("COMPILER_RT_BUILD_SANITIZERS", "OFF")
148+
.define("COMPILER_RT_BUILD_EMUTLS", "OFF")
149+
// inform about c/c++ compilers, the c++ compiler isn't actually used but
150+
// it's needed to get the initial configure to work on all platforms.
151+
.define("CMAKE_C_COMPILER", build.cc(target))
152+
.define("CMAKE_CXX_COMPILER", build.cc(target));
153+
138154
let (dir, build_target, libname) = if target.contains("linux") ||
139155
target.contains("freebsd") ||
140156
target.contains("netbsd") {
141-
let os = if target.contains("android") {"-android"} else {""};
142-
let arch = if arch.starts_with("arm") && target.contains("eabihf") {
143-
"armhf"
157+
let os_extra = if target.contains("android") && target.contains("arm") {
158+
"-android"
144159
} else {
145-
arch
160+
""
146161
};
147-
let target = format!("clang_rt.builtins-{}{}", arch, os);
162+
let builtins_arch = match arch {
163+
"i586" => "i386",
164+
"arm" | "armv7" if target.contains("android") => "armhf",
165+
"arm" if target.contains("eabihf") => "armhf",
166+
_ => arch,
167+
};
168+
let target = format!("clang_rt.builtins-{}{}", builtins_arch, os_extra);
148169
("linux".to_string(), target.clone(), target)
149-
} else if target.contains("darwin") {
150-
let target = format!("clang_rt.builtins_{}_osx", arch);
170+
} else if target.contains("apple-darwin") {
171+
let builtins_arch = match arch {
172+
"i686" => "i386",
173+
_ => arch,
174+
};
175+
let target = format!("clang_rt.builtins_{}_osx", builtins_arch);
176+
("builtins".to_string(), target.clone(), target)
177+
} else if target.contains("apple-ios") {
178+
cfg.define("COMPILER_RT_ENABLE_IOS", "ON");
179+
let target = match arch {
180+
"armv7s" => "hard_pic_armv7em_macho_embedded".to_string(),
181+
"aarch64" => "builtins_arm64_ios".to_string(),
182+
_ => format!("hard_pic_{}_macho_embedded", arch),
183+
};
151184
("builtins".to_string(), target.clone(), target)
152185
} else if target.contains("windows-gnu") {
153186
let target = format!("clang_rt.builtins-{}", arch);
154187
("windows".to_string(), target.clone(), target)
155188
} else if target.contains("windows-msvc") {
189+
let builtins_arch = match arch {
190+
"i586" | "i686" => "i386",
191+
_ => arch,
192+
};
156193
(format!("windows/{}", mode),
157194
"lib/builtins/builtins".to_string(),
158-
format!("clang_rt.builtins-{}", arch.replace("i686", "i386")))
195+
format!("clang_rt.builtins-{}", builtins_arch))
159196
} else {
160197
panic!("can't get os from target: {}", target)
161198
};
@@ -168,21 +205,7 @@ pub fn compiler_rt(build: &Build, target: &str) {
168205
}
169206
let _ = fs::remove_dir_all(&dst);
170207
t!(fs::create_dir_all(&dst));
171-
let build_llvm_config = build.llvm_config(&build.config.build);
172-
let mut cfg = cmake::Config::new(build.src.join("src/compiler-rt"));
173-
cfg.target(target)
174-
.host(&build.config.build)
175-
.out_dir(&dst)
176-
.profile(mode)
177-
.define("LLVM_CONFIG_PATH", build_llvm_config)
178-
.define("COMPILER_RT_DEFAULT_TARGET_TRIPLE", target)
179-
.define("COMPILER_RT_BUILD_SANITIZERS", "OFF")
180-
.define("COMPILER_RT_BUILD_EMUTLS", "OFF")
181-
// inform about c/c++ compilers, the c++ compiler isn't actually used but
182-
// it's needed to get the initial configure to work on all platforms.
183-
.define("CMAKE_C_COMPILER", build.cc(target))
184-
.define("CMAKE_CXX_COMPILER", build.cc(target))
185-
.build_target(&build_target);
208+
cfg.build_target(&build_target);
186209
cfg.build();
187210
}
188211

0 commit comments

Comments
 (0)