You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting from nightly-2024-04-15, there was an update to compiler_builtins which changed the way that math functions are linked (rust-lang/compiler-builtins#577). As a consequence, programs combining converted objects fail to build and link with the DJGPP toolchain because it cannot find the various functions in compiler_builtins::math.
I've been looking into this problem here and I'm thinking whether it would be best resolved at elf2djgpp directly.
Would it make sense to also translate symbols in compiler_builtins::math using this tool?
As it turns out, I could reproduce the same problem with the example project after a few changes:
cd example
./build-dos-lib.sh
Converting ELF objects to COFF-GO32...
[WARN] Replacing bad extern compiler_builtins::mem::memcpy::h812ddf986f30a505 with memcpy
[WARN] Replacing bad extern compiler_builtins::mem::memset::hf5e04de1043dcb43 with memset
[WARN] Replacing bad extern compiler_builtins::mem::memcmp::hccf529a20986adb3 with memcmp
[WARN] Replacing bad extern compiler_builtins::mem::bcmp::h08ab184912ed088e with bcmp
[WARN] Replacing bad extern compiler_builtins::mem::memmove::h1be8968bbec95ef8 with memmove
build/debug/librust_lib.a built
make debug
i686-pc-msdosdjgpp-gcc -g -O0 -o build/debug/example.exe example.c build/debug/librust_lib.a
/usr/lib/gcc/i686-pc-msdosdjgpp/14.1.0/../../../../i686-pc-msdosdjgpp/bin/ld: build/debug/librust_lib.a(compiler_builtins-959ba4b0dcda654e.compiler_builtins.25b58a9b9e6e87fe-cgu.1.rcgu.o):compiler_builtins.25b58a9b9e6e87fe-cgu.1:(.text+0xc): undefined reference to `compiler_builtins::math::round'
/usr/lib/gcc/i686-pc-msdosdjgpp/14.1.0/../../../../i686-pc-msdosdjgpp/bin/ld: build/debug/librust_lib.a(compiler_builtins-959ba4b0dcda654e.compiler_builtins.25b58a9b9e6e87fe-cgu.1.rcgu.o):compiler_builtins.25b58a9b9e6e87fe-cgu.1:(.text+0xc): undefined reference to `compiler_builtins::math::trunc'
/usr/lib/gcc/i686-pc-msdosdjgpp/14.1.0/../../../../i686-pc-msdosdjgpp/bin/ld: build/debug/librust_lib.a(compiler_builtins-959ba4b0dcda654e.compiler_builtins.25b58a9b9e6e87fe-cgu.1.rcgu.o):compiler_builtins.25b58a9b9e6e87fe-cgu.1:(.text+0xa): undefined reference to `compiler_builtins::math::asinf'
...
The text was updated successfully, but these errors were encountered:
diff --git a/src/coff_go32.rs b/src/coff_go32.rs
index d0bd2d4..1aeb7a4 100644
--- a/src/coff_go32.rs+++ b/src/coff_go32.rs@@ -32,13 +32,14 @@ pub const R_386_GOTPC: u32 = 10;
///
/// Link them to the real DJGPP functions instead by renaming the symbols, what could possibly go
/// wrong
-const FIX_EXTERN_SYMBOLS_PREFIXES: [(&str, &[u8]); 6] = [+const FIX_EXTERN_SYMBOLS_PREFIXES: [(&str, &[u8]); 7] = [
("compiler_builtins::mem::memset", b"memset"),
("compiler_builtins::mem::memcmp", b"memcmp"),
("compiler_builtins::mem::bcmp", b"bcmp"),
("compiler_builtins::mem::strlen", b"strlen"),
("compiler_builtins::mem::memcpy", b"memcpy"),
("compiler_builtins::mem::memmove", b"memmove"),
+ ("compiler_builtins::math::", b""),
];
pub fn fix_extern_symbol(name: Cow<[u8]>) -> Cow<[u8]> {
I could build my projects successfully using nightly-2024-04-15 as well as the latest nightly, nightly-2024-07-26. Please let me know if you want me to send a PR your way. :)
Starting from
nightly-2024-04-15
, there was an update tocompiler_builtins
which changed the way that math functions are linked (rust-lang/compiler-builtins#577). As a consequence, programs combining converted objects fail to build and link with the DJGPP toolchain because it cannot find the various functions incompiler_builtins::math
.I've been looking into this problem here and I'm thinking whether it would be best resolved at
elf2djgpp
directly.Would it make sense to also translate symbols in
compiler_builtins::math
using this tool?As it turns out, I could reproduce the same problem with the example project after a few changes:
cd example ./build-dos-lib.sh Converting ELF objects to COFF-GO32... [WARN] Replacing bad extern compiler_builtins::mem::memcpy::h812ddf986f30a505 with memcpy [WARN] Replacing bad extern compiler_builtins::mem::memset::hf5e04de1043dcb43 with memset [WARN] Replacing bad extern compiler_builtins::mem::memcmp::hccf529a20986adb3 with memcmp [WARN] Replacing bad extern compiler_builtins::mem::bcmp::h08ab184912ed088e with bcmp [WARN] Replacing bad extern compiler_builtins::mem::memmove::h1be8968bbec95ef8 with memmove build/debug/librust_lib.a built
The text was updated successfully, but these errors were encountered: