Relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `my_fn'

Can some one help to solve the error -

have the following code in one file, got linker error of: “undefined reference to main_fn' relocation truncated to fit: R_AARCH64_CALL26 against undefined symbolmy_fn’”

… #![feature(global_asm)] … global_asm!( r#"

.section .text … bl main_fn lp_nop: nop b lp_nop "# );

pub unsafe fn my_fn() { let mut addr: u32 = 0xf7113000; let _raw_mut = &mut addr as *mut u32; while true { unsafe { *_raw_mut = 88; } } }

Missing #[no_mangle] on my_fn. Also extern "C" should be used too.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.