Skip to content

Commit 070990f

Browse files
committed
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.
1 parent 906b2bf commit 070990f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ These builtins are never called by LLVM.
306306
- ~~ctzdi2.c~~
307307
- ~~ctzsi2.c~~
308308
- ~~ctzti2.c~~
309-
- ~~ffsdi2.c~~
309+
- ~~ffsdi2.c~~ - this is [called by gcc][jemalloc-fail] though!
310310
- ~~ffsti2.c~~
311311
- ~~mulvdi3.c~~
312312
- ~~mulvsi3.c~~
@@ -333,6 +333,8 @@ These builtins are never called by LLVM.
333333
- ~~ucmpti2.c~~
334334
- ~~udivmodti4.c~~
335335

336+
[jemalloc-fail]: https://travis-ci.org/rust-lang/rust/jobs/249772758
337+
336338
Rust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations.
337339

338340
- ~~arm/sync_fetch_and_add_4.S~~

build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -4095,6 +4095,16 @@ mod c {
40954095
],
40964096
);
40974097

4098+
// When compiling in rustbuild (the rust-lang/rust repo) this library
4099+
// also needs to satisfy intrinsics that jemalloc or C in general may
4100+
// need, so include a few more that aren't typically needed by
4101+
// LLVM/Rust.
4102+
if env::var_os("CARGO_FEATURE_RUSTBUILD").is_some() {
4103+
sources.exend(&[
4104+
"ffsdi2.c",
4105+
]);
4106+
}
4107+
40984108
if target_os != "ios" {
40994109
sources.extend(
41004110
&[

0 commit comments

Comments
 (0)