about summary refs log tree commit diff
path: root/library/compiler-builtins
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-07-03 14:57:42 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-07-03 15:00:51 -0700
commitebcf7fac6a90bb4b5deaf7fda4ad71d3a00a7b2e (patch)
tree1daf295e4d9c6de2dce5e0c231013956b2c998c6 /library/compiler-builtins
parent96bee16e7dac5280ecc781543f605d25924340df (diff)
downloadrust-ebcf7fac6a90bb4b5deaf7fda4ad71d3a00a7b2e.tar.gz
rust-ebcf7fac6a90bb4b5deaf7fda4ad71d3a00a7b2e.zip
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.
Diffstat (limited to 'library/compiler-builtins')
-rw-r--r--library/compiler-builtins/README.md4
-rw-r--r--library/compiler-builtins/build.rs10
2 files changed, 13 insertions, 1 deletions
diff --git a/library/compiler-builtins/README.md b/library/compiler-builtins/README.md
index 5f59b44b1a8..a0e2a29ed15 100644
--- a/library/compiler-builtins/README.md
+++ b/library/compiler-builtins/README.md
@@ -306,7 +306,7 @@ These builtins are never called by LLVM.
 - ~~ctzdi2.c~~
 - ~~ctzsi2.c~~
 - ~~ctzti2.c~~
-- ~~ffsdi2.c~~
+- ~~ffsdi2.c~~ - this is [called by gcc][jemalloc-fail] though!
 - ~~ffsti2.c~~
 - ~~mulvdi3.c~~
 - ~~mulvsi3.c~~
@@ -333,6 +333,8 @@ These builtins are never called by LLVM.
 - ~~ucmpti2.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.
 
 - ~~arm/sync_fetch_and_add_4.S~~
diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs
index 17df4b6435a..22196455413 100644
--- a/library/compiler-builtins/build.rs
+++ b/library/compiler-builtins/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" {
             sources.extend(
                 &[