瀏覽代碼

Compile ffsdi2 with `rustbuild` feature

This is not used by LLVM/Rust, but is apparently used by gcc/C which jemalloc
can require at least.
Alex Crichton 7 年之前
父節點
當前提交
070990f10a
共有 2 個文件被更改,包括 13 次插入1 次删除
  1. 3 1
      README.md
  2. 10 0
      build.rs

+ 3 - 1
README.md

@@ -306,7 +306,7 @@ These builtins are never called by LLVM.
 - ~~ctzdi2.c~~
 - ~~ctzdi2.c~~
 - ~~ctzsi2.c~~
 - ~~ctzsi2.c~~
 - ~~ctzti2.c~~
 - ~~ctzti2.c~~
-- ~~ffsdi2.c~~
+- ~~ffsdi2.c~~ - this is [called by gcc][jemalloc-fail] though!
 - ~~ffsti2.c~~
 - ~~ffsti2.c~~
 - ~~mulvdi3.c~~
 - ~~mulvdi3.c~~
 - ~~mulvsi3.c~~
 - ~~mulvsi3.c~~
@@ -333,6 +333,8 @@ These builtins are never called by LLVM.
 - ~~ucmpti2.c~~
 - ~~ucmpti2.c~~
 - ~~udivmodti4.c~~
 - ~~udivmodti4.c~~
 
 
+[jemalloc-fail]: https://travis-ci.org/rust-lang/rust/jobs/249772758
+
 Rust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations.
 Rust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations.
 
 
 - ~~arm/sync_fetch_and_add_4.S~~
 - ~~arm/sync_fetch_and_add_4.S~~

+ 10 - 0
build.rs

@@ -4095,6 +4095,16 @@ mod c {
             ],
             ],
         );
         );
 
 
+        // When compiling in rustbuild (the rust-lang/rust repo) this library
+        // also needs to satisfy intrinsics that jemalloc or C in general may
+        // need, so include a few more that aren't typically needed by
+        // LLVM/Rust.
+        if env::var_os("CARGO_FEATURE_RUSTBUILD").is_some() {
+            sources.exend(&[
+                "ffsdi2.c",
+            ]);
+        }
+
         if target_os != "ios" {
         if target_os != "ios" {
             sources.extend(
             sources.extend(
                 &[
                 &[