Skip to content

Commit 3741cb0

Browse files
committed
Add a feature to compile intrinsics that are missing on the system for testing
1 parent 8941385 commit 3741cb0

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Cargo.toml

+7-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cc = { optional = true, version = "1.0" }
3939
panic-handler = { path = 'crates/panic-handler' }
4040

4141
[features]
42-
default = ["compiler-builtins"]
42+
default = ["compiler-builtins", "complete-system-rt"]
4343

4444
# Enable compilation of C code in compiler-rt, filling in some more optimized
4545
# implementations and also filling in unimplemented intrinsics
@@ -77,6 +77,12 @@ public-test-deps = []
7777
# it during linking.
7878
weak-intrinsics = []
7979

80+
# On some systems, there are no symbols available in their vendored compiler-rt
81+
# that we would want to use for testing, e.g. MacOS does not provide `f128`
82+
# intrinsics. Enabling this feature builds missing symbols from C so we have
83+
# something to test against.
84+
complete-system-rt = ["cc"]
85+
8086
[[example]]
8187
name = "intrinsics"
8288
required-features = ["compiler-builtins"]

build.rs

+9
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ mod c {
463463

464464
if (target_arch == "aarch64" || target_arch == "arm64ec") && consider_float_intrinsics {
465465
sources.extend(&[
466+
("__comparetf2", "comparetf2.c"),
466467
("__extenddftf2", "extenddftf2.c"),
467468
("__extendsftf2", "extendsftf2.c"),
468469
("__fixtfdi", "fixtfdi.c"),
@@ -499,11 +500,15 @@ mod c {
499500
sources.extend(&[
500501
("__extenddftf2", "extenddftf2.c"),
501502
("__netf2", "comparetf2.c"),
503+
("__addtf3", "addtf3.c"),
504+
("__multf3", "multf3.c"),
505+
("__subtf3", "subtf3.c"),
502506
("__fixtfsi", "fixtfsi.c"),
503507
("__floatsitf", "floatsitf.c"),
504508
("__fixunstfsi", "fixunstfsi.c"),
505509
("__floatunsitf", "floatunsitf.c"),
506510
("__fe_getround", "fp_mode.c"),
511+
("__divtf3", "divtf3.c"),
507512
("__trunctfdf2", "trunctfdf2.c"),
508513
("__trunctfsf2", "trunctfsf2.c"),
509514
]);
@@ -513,11 +518,15 @@ mod c {
513518
sources.extend(&[
514519
("__extenddftf2", "extenddftf2.c"),
515520
("__netf2", "comparetf2.c"),
521+
("__addtf3", "addtf3.c"),
522+
("__multf3", "multf3.c"),
523+
("__subtf3", "subtf3.c"),
516524
("__fixtfsi", "fixtfsi.c"),
517525
("__floatsitf", "floatsitf.c"),
518526
("__fixunstfsi", "fixunstfsi.c"),
519527
("__floatunsitf", "floatunsitf.c"),
520528
("__fe_getround", "fp_mode.c"),
529+
("__divtf3", "divtf3.c"),
521530
("__trunctfdf2", "trunctfdf2.c"),
522531
("__trunctfsf2", "trunctfsf2.c"),
523532
]);

testcrate/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ utest-cortex-m-qemu = { default-features = false, git = "https://github.com/japa
2525
utest-macros = { git = "https://github.com/japaric/utest" }
2626

2727
[features]
28-
default = ["mangled-names"]
28+
default = ["mangled-names", "complete-system-rt"]
2929
c = ["compiler_builtins/c"]
3030
no-asm = ["compiler_builtins/no-asm"]
3131
mem = ["compiler_builtins/mem"]
3232
mangled-names = ["compiler_builtins/mangled-names"]
33+
complete-system-rt = ["compiler_builtins/complete-system-rt"]

0 commit comments

Comments
 (0)