Longcalls to runtime linked functions
⚓ Rust 📅 2025-10-18 👤 surdeus 👁️ 3Is there any way to force the compiler to create "long calls" when branching to runtime linked functions.
My binary needs to be relocatable and to be able to call late linked functions potentially anywhere in memory.
Currently, the compiler is emitting immediate form BL instructions and a relocation type of R_ARM_THM_CALL, which has a limited range. For my scenario, it would be more ideal if the compiler emitted a register form BL instruction and a more flexible R_ARM_ABS32 for the value that is loaded into the register. Or something similar to that. What I need is something that allows branching over very large distances.
By way of comparison, GCC has the long_call function attribute, or the -mlong-calls option. However, there doesn't seem to be any equivalent option or attribute for Rust.
Is there any way of achieving this with current Rust? Or Or does anyone have any other suggestions.
3 posts - 2 participants
🏷️ Rust_feed