build.rs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. use std::env;
  2. fn main() {
  3. println!("cargo:rerun-if-changed=build.rs");
  4. let target = env::var("TARGET").unwrap();
  5. let cwd = env::current_dir().unwrap();
  6. println!("cargo:compiler-rt={}", cwd.join("compiler-rt").display());
  7. // Activate libm's unstable features to make full use of Nightly.
  8. println!("cargo:rustc-cfg=feature=\"unstable\"");
  9. // Emscripten's runtime includes all the builtins
  10. if target.contains("emscripten") {
  11. return;
  12. }
  13. // OpenBSD provides compiler_rt by default, use it instead of rebuilding it from source
  14. if target.contains("openbsd") {
  15. println!("cargo:rustc-link-search=native=/usr/lib");
  16. println!("cargo:rustc-link-lib=compiler_rt");
  17. return;
  18. }
  19. // Forcibly enable memory intrinsics on wasm32 & SGX as we don't have a libc to
  20. // provide them.
  21. if (target.contains("wasm32") && !target.contains("wasi"))
  22. || (target.contains("sgx") && target.contains("fortanix"))
  23. || target.contains("nvptx")
  24. {
  25. println!("cargo:rustc-cfg=feature=\"mem\"");
  26. }
  27. // NOTE we are going to assume that llvm-target, what determines our codegen option, matches the
  28. // target triple. This is usually correct for our built-in targets but can break in presence of
  29. // custom targets, which can have arbitrary names.
  30. let llvm_target = target.split('-').collect::<Vec<_>>();
  31. // Build missing intrinsics from compiler-rt C source code. If we're
  32. // mangling names though we assume that we're also in test mode so we don't
  33. // build anything and we rely on the upstream implementation of compiler-rt
  34. // functions
  35. if !cfg!(feature = "mangled-names") && cfg!(feature = "c") {
  36. // Don't use a C compiler for these targets:
  37. //
  38. // * wasm32 - clang 8 for wasm is somewhat hard to come by and it's
  39. // unlikely that the C is really that much better than our own Rust.
  40. // * nvptx - everything is bitcode, not compatible with mixed C/Rust
  41. // * riscv - the rust-lang/rust distribution container doesn't have a C
  42. // compiler nor is cc-rs ready for compilation to riscv (at this
  43. // time). This can probably be removed in the future
  44. if !target.contains("wasm32") && !target.contains("nvptx") && !target.starts_with("riscv") {
  45. #[cfg(feature = "c")]
  46. c::compile(&llvm_target, &target);
  47. }
  48. }
  49. // To compile intrinsics.rs for thumb targets, where there is no libc
  50. if llvm_target[0].starts_with("thumb") {
  51. println!("cargo:rustc-cfg=thumb")
  52. }
  53. // compiler-rt `cfg`s away some intrinsics for thumbv6m and thumbv8m.base because
  54. // these targets do not have full Thumb-2 support but only original Thumb-1.
  55. // We have to cfg our code accordingly.
  56. if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" {
  57. println!("cargo:rustc-cfg=thumb_1")
  58. }
  59. // Only emit the ARM Linux atomic emulation on pre-ARMv6 architectures.
  60. if llvm_target[0] == "armv4t" || llvm_target[0] == "armv5te" {
  61. println!("cargo:rustc-cfg=kernel_user_helpers")
  62. }
  63. }
  64. #[cfg(feature = "c")]
  65. mod c {
  66. extern crate cc;
  67. use std::collections::BTreeMap;
  68. use std::env;
  69. use std::path::PathBuf;
  70. struct Sources {
  71. // SYMBOL -> PATH TO SOURCE
  72. map: BTreeMap<&'static str, &'static str>,
  73. }
  74. impl Sources {
  75. fn new() -> Sources {
  76. Sources {
  77. map: BTreeMap::new(),
  78. }
  79. }
  80. fn extend(&mut self, sources: &[(&'static str, &'static str)]) {
  81. // NOTE Some intrinsics have both a generic implementation (e.g.
  82. // `floatdidf.c`) and an arch optimized implementation
  83. // (`x86_64/floatdidf.c`). In those cases, we keep the arch optimized
  84. // implementation and discard the generic implementation. If we don't
  85. // and keep both implementations, the linker will yell at us about
  86. // duplicate symbols!
  87. for (symbol, src) in sources {
  88. if src.contains("/") {
  89. // Arch-optimized implementation (preferred)
  90. self.map.insert(symbol, src);
  91. } else {
  92. // Generic implementation
  93. if !self.map.contains_key(symbol) {
  94. self.map.insert(symbol, src);
  95. }
  96. }
  97. }
  98. }
  99. fn remove(&mut self, symbols: &[&str]) {
  100. for symbol in symbols {
  101. self.map.remove(*symbol).unwrap();
  102. }
  103. }
  104. }
  105. /// Compile intrinsics from the compiler-rt C source code
  106. pub fn compile(llvm_target: &[&str], target: &String) {
  107. let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
  108. let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
  109. let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
  110. let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap();
  111. let mut consider_float_intrinsics = true;
  112. let cfg = &mut cc::Build::new();
  113. // AArch64 GCCs exit with an error condition when they encounter any kind of floating point
  114. // code if the `nofp` and/or `nosimd` compiler flags have been set.
  115. //
  116. // Therefore, evaluate if those flags are present and set a boolean that causes any
  117. // compiler-rt intrinsics that contain floating point source to be excluded for this target.
  118. if target_arch == "aarch64" {
  119. let cflags_key = String::from("CFLAGS_") + &(target.to_owned().replace("-", "_"));
  120. if let Ok(cflags_value) = env::var(cflags_key) {
  121. if cflags_value.contains("+nofp") || cflags_value.contains("+nosimd") {
  122. consider_float_intrinsics = false;
  123. }
  124. }
  125. }
  126. cfg.warnings(false);
  127. if target_env == "msvc" {
  128. // Don't pull in extra libraries on MSVC
  129. cfg.flag("/Zl");
  130. // Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP
  131. cfg.define("__func__", Some("__FUNCTION__"));
  132. } else {
  133. // Turn off various features of gcc and such, mostly copying
  134. // compiler-rt's build system already
  135. cfg.flag("-fno-builtin");
  136. cfg.flag("-fvisibility=hidden");
  137. cfg.flag("-ffreestanding");
  138. // Avoid the following warning appearing once **per file**:
  139. // clang: warning: optimization flag '-fomit-frame-pointer' is not supported for target 'armv7' [-Wignored-optimization-argument]
  140. //
  141. // Note that compiler-rt's build system also checks
  142. //
  143. // `check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)`
  144. //
  145. // in https://github.com/rust-lang/compiler-rt/blob/c8fbcb3/cmake/config-ix.cmake#L19.
  146. cfg.flag_if_supported("-fomit-frame-pointer");
  147. cfg.define("VISIBILITY_HIDDEN", None);
  148. }
  149. let mut sources = Sources::new();
  150. sources.extend(&[
  151. ("__absvdi2", "absvdi2.c"),
  152. ("__absvsi2", "absvsi2.c"),
  153. ("__addvdi3", "addvdi3.c"),
  154. ("__addvsi3", "addvsi3.c"),
  155. ("apple_versioning", "apple_versioning.c"),
  156. ("__clzdi2", "clzdi2.c"),
  157. ("__clzsi2", "clzsi2.c"),
  158. ("__cmpdi2", "cmpdi2.c"),
  159. ("__ctzdi2", "ctzdi2.c"),
  160. ("__ctzsi2", "ctzsi2.c"),
  161. ("__int_util", "int_util.c"),
  162. ("__mulvdi3", "mulvdi3.c"),
  163. ("__mulvsi3", "mulvsi3.c"),
  164. ("__negdi2", "negdi2.c"),
  165. ("__negvdi2", "negvdi2.c"),
  166. ("__negvsi2", "negvsi2.c"),
  167. ("__paritydi2", "paritydi2.c"),
  168. ("__paritysi2", "paritysi2.c"),
  169. ("__popcountdi2", "popcountdi2.c"),
  170. ("__popcountsi2", "popcountsi2.c"),
  171. ("__subvdi3", "subvdi3.c"),
  172. ("__subvsi3", "subvsi3.c"),
  173. ("__ucmpdi2", "ucmpdi2.c"),
  174. ]);
  175. if consider_float_intrinsics {
  176. sources.extend(&[
  177. ("__divdc3", "divdc3.c"),
  178. ("__divsc3", "divsc3.c"),
  179. ("__divxc3", "divxc3.c"),
  180. ("__extendhfsf2", "extendhfsf2.c"),
  181. ("__muldc3", "muldc3.c"),
  182. ("__mulsc3", "mulsc3.c"),
  183. ("__mulxc3", "mulxc3.c"),
  184. ("__negdf2", "negdf2.c"),
  185. ("__negsf2", "negsf2.c"),
  186. ("__powixf2", "powixf2.c"),
  187. ("__truncdfhf2", "truncdfhf2.c"),
  188. ("__truncdfsf2", "truncdfsf2.c"),
  189. ("__truncsfhf2", "truncsfhf2.c"),
  190. ]);
  191. }
  192. // When compiling in rustbuild (the rust-lang/rust repo) this library
  193. // also needs to satisfy intrinsics that jemalloc or C in general may
  194. // need, so include a few more that aren't typically needed by
  195. // LLVM/Rust.
  196. if cfg!(feature = "rustbuild") {
  197. sources.extend(&[("__ffsdi2", "ffsdi2.c")]);
  198. }
  199. // On iOS and 32-bit OSX these are all just empty intrinsics, no need to
  200. // include them.
  201. if target_os != "ios" && (target_vendor != "apple" || target_arch != "x86") {
  202. sources.extend(&[
  203. ("__absvti2", "absvti2.c"),
  204. ("__addvti3", "addvti3.c"),
  205. ("__clzti2", "clzti2.c"),
  206. ("__cmpti2", "cmpti2.c"),
  207. ("__ctzti2", "ctzti2.c"),
  208. ("__ffsti2", "ffsti2.c"),
  209. ("__mulvti3", "mulvti3.c"),
  210. ("__negti2", "negti2.c"),
  211. ("__parityti2", "parityti2.c"),
  212. ("__popcountti2", "popcountti2.c"),
  213. ("__subvti3", "subvti3.c"),
  214. ("__ucmpti2", "ucmpti2.c"),
  215. ]);
  216. if consider_float_intrinsics {
  217. sources.extend(&[("__negvti2", "negvti2.c")]);
  218. }
  219. }
  220. if target_vendor == "apple" {
  221. sources.extend(&[
  222. ("atomic_flag_clear", "atomic_flag_clear.c"),
  223. ("atomic_flag_clear_explicit", "atomic_flag_clear_explicit.c"),
  224. ("atomic_flag_test_and_set", "atomic_flag_test_and_set.c"),
  225. (
  226. "atomic_flag_test_and_set_explicit",
  227. "atomic_flag_test_and_set_explicit.c",
  228. ),
  229. ("atomic_signal_fence", "atomic_signal_fence.c"),
  230. ("atomic_thread_fence", "atomic_thread_fence.c"),
  231. ]);
  232. }
  233. if target_env == "msvc" {
  234. if target_arch == "x86_64" {
  235. sources.extend(&[
  236. ("__floatdisf", "x86_64/floatdisf.c"),
  237. ("__floatdixf", "x86_64/floatdixf.c"),
  238. ]);
  239. }
  240. } else {
  241. // None of these seem to be used on x86_64 windows, and they've all
  242. // got the wrong ABI anyway, so we want to avoid them.
  243. if target_os != "windows" {
  244. if target_arch == "x86_64" {
  245. sources.extend(&[
  246. ("__floatdisf", "x86_64/floatdisf.c"),
  247. ("__floatdixf", "x86_64/floatdixf.c"),
  248. ("__floatundidf", "x86_64/floatundidf.S"),
  249. ("__floatundisf", "x86_64/floatundisf.S"),
  250. ("__floatundixf", "x86_64/floatundixf.S"),
  251. ]);
  252. }
  253. }
  254. if target_arch == "x86" {
  255. sources.extend(&[
  256. ("__ashldi3", "i386/ashldi3.S"),
  257. ("__ashrdi3", "i386/ashrdi3.S"),
  258. ("__divdi3", "i386/divdi3.S"),
  259. ("__floatdidf", "i386/floatdidf.S"),
  260. ("__floatdisf", "i386/floatdisf.S"),
  261. ("__floatdixf", "i386/floatdixf.S"),
  262. ("__floatundidf", "i386/floatundidf.S"),
  263. ("__floatundisf", "i386/floatundisf.S"),
  264. ("__floatundixf", "i386/floatundixf.S"),
  265. ("__lshrdi3", "i386/lshrdi3.S"),
  266. ("__moddi3", "i386/moddi3.S"),
  267. ("__muldi3", "i386/muldi3.S"),
  268. ("__udivdi3", "i386/udivdi3.S"),
  269. ("__umoddi3", "i386/umoddi3.S"),
  270. ]);
  271. }
  272. }
  273. if target_arch == "arm" && target_os != "ios" && target_env != "msvc" {
  274. sources.extend(&[
  275. ("__aeabi_div0", "arm/aeabi_div0.c"),
  276. ("__aeabi_drsub", "arm/aeabi_drsub.c"),
  277. ("__aeabi_frsub", "arm/aeabi_frsub.c"),
  278. ("__bswapdi2", "arm/bswapdi2.S"),
  279. ("__bswapsi2", "arm/bswapsi2.S"),
  280. ("__clzdi2", "arm/clzdi2.S"),
  281. ("__clzsi2", "arm/clzsi2.S"),
  282. ("__divmodsi4", "arm/divmodsi4.S"),
  283. ("__divsi3", "arm/divsi3.S"),
  284. ("__modsi3", "arm/modsi3.S"),
  285. ("__switch16", "arm/switch16.S"),
  286. ("__switch32", "arm/switch32.S"),
  287. ("__switch8", "arm/switch8.S"),
  288. ("__switchu8", "arm/switchu8.S"),
  289. ("__sync_synchronize", "arm/sync_synchronize.S"),
  290. ("__udivmodsi4", "arm/udivmodsi4.S"),
  291. ("__udivsi3", "arm/udivsi3.S"),
  292. ("__umodsi3", "arm/umodsi3.S"),
  293. ]);
  294. if target_os == "freebsd" {
  295. sources.extend(&[("__clear_cache", "clear_cache.c")]);
  296. }
  297. // First of all aeabi_cdcmp and aeabi_cfcmp are never called by LLVM.
  298. // Second are little-endian only, so build fail on big-endian targets.
  299. // Temporally workaround: exclude these files for big-endian targets.
  300. if !llvm_target[0].starts_with("thumbeb") && !llvm_target[0].starts_with("armeb") {
  301. sources.extend(&[
  302. ("__aeabi_cdcmp", "arm/aeabi_cdcmp.S"),
  303. ("__aeabi_cdcmpeq_check_nan", "arm/aeabi_cdcmpeq_check_nan.c"),
  304. ("__aeabi_cfcmp", "arm/aeabi_cfcmp.S"),
  305. ("__aeabi_cfcmpeq_check_nan", "arm/aeabi_cfcmpeq_check_nan.c"),
  306. ]);
  307. }
  308. }
  309. if llvm_target[0] == "armv7" {
  310. sources.extend(&[
  311. ("__sync_fetch_and_add_4", "arm/sync_fetch_and_add_4.S"),
  312. ("__sync_fetch_and_add_8", "arm/sync_fetch_and_add_8.S"),
  313. ("__sync_fetch_and_and_4", "arm/sync_fetch_and_and_4.S"),
  314. ("__sync_fetch_and_and_8", "arm/sync_fetch_and_and_8.S"),
  315. ("__sync_fetch_and_max_4", "arm/sync_fetch_and_max_4.S"),
  316. ("__sync_fetch_and_max_8", "arm/sync_fetch_and_max_8.S"),
  317. ("__sync_fetch_and_min_4", "arm/sync_fetch_and_min_4.S"),
  318. ("__sync_fetch_and_min_8", "arm/sync_fetch_and_min_8.S"),
  319. ("__sync_fetch_and_nand_4", "arm/sync_fetch_and_nand_4.S"),
  320. ("__sync_fetch_and_nand_8", "arm/sync_fetch_and_nand_8.S"),
  321. ("__sync_fetch_and_or_4", "arm/sync_fetch_and_or_4.S"),
  322. ("__sync_fetch_and_or_8", "arm/sync_fetch_and_or_8.S"),
  323. ("__sync_fetch_and_sub_4", "arm/sync_fetch_and_sub_4.S"),
  324. ("__sync_fetch_and_sub_8", "arm/sync_fetch_and_sub_8.S"),
  325. ("__sync_fetch_and_umax_4", "arm/sync_fetch_and_umax_4.S"),
  326. ("__sync_fetch_and_umax_8", "arm/sync_fetch_and_umax_8.S"),
  327. ("__sync_fetch_and_umin_4", "arm/sync_fetch_and_umin_4.S"),
  328. ("__sync_fetch_and_umin_8", "arm/sync_fetch_and_umin_8.S"),
  329. ("__sync_fetch_and_xor_4", "arm/sync_fetch_and_xor_4.S"),
  330. ("__sync_fetch_and_xor_8", "arm/sync_fetch_and_xor_8.S"),
  331. ]);
  332. }
  333. if llvm_target.last().unwrap().ends_with("eabihf") {
  334. if !llvm_target[0].starts_with("thumbv7em")
  335. && !llvm_target[0].starts_with("thumbv8m.main")
  336. {
  337. // The FPU option chosen for these architectures in cc-rs, ie:
  338. // -mfpu=fpv4-sp-d16 for thumbv7em
  339. // -mfpu=fpv5-sp-d16 for thumbv8m.main
  340. // do not support double precision floating points conversions so the files
  341. // that include such instructions are not included for these targets.
  342. sources.extend(&[
  343. ("__fixdfsivfp", "arm/fixdfsivfp.S"),
  344. ("__fixunsdfsivfp", "arm/fixunsdfsivfp.S"),
  345. ("__floatsidfvfp", "arm/floatsidfvfp.S"),
  346. ("__floatunssidfvfp", "arm/floatunssidfvfp.S"),
  347. ]);
  348. }
  349. sources.extend(&[
  350. ("__fixsfsivfp", "arm/fixsfsivfp.S"),
  351. ("__fixunssfsivfp", "arm/fixunssfsivfp.S"),
  352. ("__floatsisfvfp", "arm/floatsisfvfp.S"),
  353. ("__floatunssisfvfp", "arm/floatunssisfvfp.S"),
  354. ("__floatunssisfvfp", "arm/floatunssisfvfp.S"),
  355. ("__restore_vfp_d8_d15_regs", "arm/restore_vfp_d8_d15_regs.S"),
  356. ("__save_vfp_d8_d15_regs", "arm/save_vfp_d8_d15_regs.S"),
  357. ("__negdf2vfp", "arm/negdf2vfp.S"),
  358. ("__negsf2vfp", "arm/negsf2vfp.S"),
  359. ]);
  360. }
  361. if target_arch == "aarch64" && consider_float_intrinsics {
  362. sources.extend(&[
  363. ("__comparetf2", "comparetf2.c"),
  364. ("__extenddftf2", "extenddftf2.c"),
  365. ("__extendsftf2", "extendsftf2.c"),
  366. ("__fixtfdi", "fixtfdi.c"),
  367. ("__fixtfsi", "fixtfsi.c"),
  368. ("__fixtfti", "fixtfti.c"),
  369. ("__fixunstfdi", "fixunstfdi.c"),
  370. ("__fixunstfsi", "fixunstfsi.c"),
  371. ("__fixunstfti", "fixunstfti.c"),
  372. ("__floatditf", "floatditf.c"),
  373. ("__floatsitf", "floatsitf.c"),
  374. ("__floatunditf", "floatunditf.c"),
  375. ("__floatunsitf", "floatunsitf.c"),
  376. ("__trunctfdf2", "trunctfdf2.c"),
  377. ("__trunctfsf2", "trunctfsf2.c"),
  378. ]);
  379. if target_os != "windows" {
  380. sources.extend(&[("__multc3", "multc3.c")]);
  381. }
  382. if target_env == "musl" {
  383. sources.extend(&[
  384. ("__addtf3", "addtf3.c"),
  385. ("__multf3", "multf3.c"),
  386. ("__subtf3", "subtf3.c"),
  387. ("__divtf3", "divtf3.c"),
  388. ("__powitf2", "powitf2.c"),
  389. ("__fe_getround", "fp_mode.c"),
  390. ("__fe_raise_inexact", "fp_mode.c"),
  391. ]);
  392. }
  393. }
  394. if target_arch == "mips" {
  395. sources.extend(&[("__bswapsi2", "bswapsi2.c")]);
  396. }
  397. if target_arch == "mips64" {
  398. sources.extend(&[
  399. ("__extenddftf2", "extenddftf2.c"),
  400. ("__netf2", "comparetf2.c"),
  401. ("__addtf3", "addtf3.c"),
  402. ("__multf3", "multf3.c"),
  403. ("__subtf3", "subtf3.c"),
  404. ("__fixtfsi", "fixtfsi.c"),
  405. ("__floatsitf", "floatsitf.c"),
  406. ("__fixunstfsi", "fixunstfsi.c"),
  407. ("__floatunsitf", "floatunsitf.c"),
  408. ("__fe_getround", "fp_mode.c"),
  409. ]);
  410. }
  411. // Remove the assembly implementations that won't compile for the target
  412. if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" {
  413. let mut to_remove = Vec::new();
  414. for (k, v) in sources.map.iter() {
  415. if v.ends_with(".S") {
  416. to_remove.push(*k);
  417. }
  418. }
  419. sources.remove(&to_remove);
  420. // But use some generic implementations where possible
  421. sources.extend(&[("__clzdi2", "clzdi2.c"), ("__clzsi2", "clzsi2.c")])
  422. }
  423. if llvm_target[0] == "thumbv7m" || llvm_target[0] == "thumbv7em" {
  424. sources.remove(&["__aeabi_cdcmp", "__aeabi_cfcmp"]);
  425. }
  426. // When compiling the C code we require the user to tell us where the
  427. // source code is, and this is largely done so when we're compiling as
  428. // part of rust-lang/rust we can use the same llvm-project repository as
  429. // rust-lang/rust.
  430. let root = match env::var_os("RUST_COMPILER_RT_ROOT") {
  431. Some(s) => PathBuf::from(s),
  432. None => panic!("RUST_COMPILER_RT_ROOT is not set"),
  433. };
  434. if !root.exists() {
  435. panic!("RUST_COMPILER_RT_ROOT={} does not exist", root.display());
  436. }
  437. // Support deterministic builds by remapping the __FILE__ prefix if the
  438. // compiler supports it. This fixes the nondeterminism caused by the
  439. // use of that macro in lib/builtins/int_util.h in compiler-rt.
  440. cfg.flag_if_supported(&format!("-ffile-prefix-map={}=.", root.display()));
  441. let src_dir = root.join("lib/builtins");
  442. for (sym, src) in sources.map.iter() {
  443. let src = src_dir.join(src);
  444. cfg.file(&src);
  445. println!("cargo:rerun-if-changed={}", src.display());
  446. println!("cargo:rustc-cfg={}=\"optimized-c\"", sym);
  447. }
  448. cfg.compile("libcompiler-rt.a");
  449. }
  450. }