Merge branch 'fix-libm' into 'master'

Strip conflicting symbols from compiler builtins

See merge request redox-os/relibc!734
This commit is contained in:
Jeremy Soller
2025-10-05 11:11:27 -06:00
2 changed files with 19 additions and 0 deletions
+2
View File
@@ -201,6 +201,7 @@ $(BUILD)/debug/libc.a: $(BUILD)/debug/librelibc.a $(BUILD)/openlibm/libopenlibm.
$(BUILD)/debug/librelibc.a: $(SRC)
$(CARGO) rustc $(CARGOFLAGS) -- --emit link=$@ -g -C debug-assertions=no $(RUSTCFLAGS)
./renamesyms.sh "$@" "$(BUILD)/debug/deps/"
./stripcore.sh "$@"
touch $@
$(BUILD)/debug/crt0.o: $(SRC)
@@ -238,6 +239,7 @@ $(BUILD)/release/librelibc.a: $(SRC)
# TODO: Better to only allow a certain whitelisted set of symbols? Perhaps
# use some cbindgen hook, specify them manually, or grep for #[unsafe(no_mangle)].
./renamesyms.sh "$@" "$(BUILD)/release/deps/"
./stripcore.sh "$@"
touch $@
$(BUILD)/release/crt0.o: $(SRC)
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# This script exists as a workaround for https://github.com/rust-lang/rust/issues/142119
set -e
target=$1
if [ -z "$target" ]; then
echo "Usage:\n\t./stripcore.sh TARGET"
exit 1
fi
for sym in cbrtf ceilf copysignf fabsf fdimf floorf fmaxf fminf fmofd rintf roundf sqrtf truncf \
cbrt ceil copysign fabs fdim floor fmax fmin fmod rint round sqrt trunc; do \
objcopy --globalize-symbol=$sym --strip-symbol=$sym "$target"; \
done