-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-eBPFTarget: I heard you liked code execution so I put some code execution in your code executionTarget: I heard you liked code execution so I put some code execution in your code executionT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
Code
#![cfg_attr(target_arch = "bpf", no_std)]
#[link(name = "compiler_builtins", kind = "static")]
extern "C" {}
#[cfg(target_arch = "bpf")]
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
unsafe { core::hint::unreachable_unchecked() }
}
pub fn sol_log_data(data: &[&[u8]]) {
let sol_log_data: unsafe extern "C" fn(data: *const u8, len: u64) = unsafe { core::mem::transmute(0x7317b434_usize) };
unsafe { sol_log_data(data.as_ptr() as *const u8, data.len() as u64) }
}
// #[no_mangle]
// fn __multi3(a: u128, b: u128) -> u128 {
// 0
// }
extern "C" {
fn __multi3(a: u128, b: u128) -> u128;
}
// #[used]
// static _KEEP_MULTI3: unsafe fn(u128, u128) -> u128 = __multi3;
#[unsafe(no_mangle)]
pub fn entrypoint(input: *mut u8) -> u64 {
let y: u128 = unsafe { __multi3(*(input.add(0x0010) as *const u128), 0x05) };
let x: u128 = unsafe { (*(input.add(0x0010) as *const u128)) * 0x05 };
sol_log_data(&[x.to_le_bytes().as_ref()]);
sol_log_data(&[y.to_le_bytes().as_ref()]);
0
}
#[cfg(test)]
mod tests {
use mollusk_svm::{Mollusk, result::Check};
use solana_instruction::Instruction;
#[test]
pub fn hello_world() {
let mollusk = Mollusk::new(&[2u8;32].into(), "target/bpfel-unknown-none/release/libupstream_u128_test");
mollusk.process_and_validate_instruction(&Instruction {
program_id: [2u8;32].into(),
accounts: vec![],
data: vec![0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
}, &vec![], &[
Check::success()
]);
}
}Meta
rustc --version --verbose:
rustc 1.91.1 (ed61e7d7e 2025-11-07)
binary: rustc
commit-hash: ed61e7d7e242494fb7057f2657300d9e77bb4fcb
commit-date: 2025-11-07
host: aarch64-apple-darwin
release: 1.91.1
LLVM version: 21.1.2
Error output
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/linker.rs:2077:9:
staticlibs not supported
stack backtrace:
0: 0x110a94d08 - std::backtrace::Backtrace::create::h19cedfa09f31f796
1: 0x10eadc4a0 - std[4f80e808129b856b]::panicking::update_hook::<alloc[9ea57ca06ed6a28a]::boxed::Box<rustc_driver_impl[2dca77a83c5d10c3]::install_ice_hook::{closure#1}>>::{closure#0}
2: 0x110a95bd0 - std::panicking::panic_with_hook::h4f9c1775cdfebc95
3: 0x110a95878 - std::panicking::panic_handler::{{closure}}::hff2f3da0c310d131
4: 0x110a8f2a4 - std::sys::backtrace::__rust_end_short_backtrace::h8ac6d0476adddd3e
5: 0x110a73e24 - __rustc[5b69f54ba72bd95a]::rust_begin_unwind
6: 0x1137fa06c - core::panicking::panic_fmt::h4af89295c468f215
7: 0x113851ba8 - <rustc_codegen_ssa[df4a98393291ceee]::back::linker::BpfLinker as rustc_codegen_ssa[df4a98393291ceee]::back::linker::Linker>::link_staticlib_by_name
8: 0x10e8e6ef8 - rustc_codegen_ssa[df4a98393291ceee]::back::link::add_native_libs_from_crate
9: 0x10e8e0bbc - rustc_codegen_ssa[df4a98393291ceee]::back::link::linker_with_args
10: 0x10e8d0604 - rustc_codegen_ssa[df4a98393291ceee]::back::link::link_natively
11: 0x10e8cc470 - rustc_codegen_ssa[df4a98393291ceee]::back::link::link_binary
12: 0x10f3a2750 - <rustc_interface[2f747f6d882c34ea]::queries::Linker>::link
13: 0x10eada9dc - rustc_interface[2f747f6d882c34ea]::interface::run_compiler::<(), rustc_driver_impl[2dca77a83c5d10c3]::run_compiler::{closure#0}>::{closure#1}
14: 0x10eace0dc - std[4f80e808129b856b]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2f747f6d882c34ea]::util::run_in_thread_with_globals<rustc_interface[2f747f6d882c34ea]::util::run_in_thread_pool_with_globals<rustc_interface[2f747f6d882c34ea]::interface::run_compiler<(), rustc_driver_impl[2dca77a83c5d10c3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
15: 0x10eae0fa0 - <<std[4f80e808129b856b]::thread::Builder>::spawn_unchecked_<rustc_interface[2f747f6d882c34ea]::util::run_in_thread_with_globals<rustc_interface[2f747f6d882c34ea]::util::run_in_thread_pool_with_globals<rustc_interface[2f747f6d882c34ea]::interface::run_compiler<(), rustc_driver_impl[2dca77a83c5d10c3]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[c3559bc9615a0249]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
16: 0x110a8bf38 - std::sys::thread::unix::Thread::new::thread_start::h261e28af5627e4c5
17: 0x188ae2c0c - __pthread_cond_wait
rustc version: 1.93.0-nightly (b6d7ff3aa 2025-11-14)
platform: aarch64-apple-darwin%
Backtrace
<backtrace>
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️O-eBPFTarget: I heard you liked code execution so I put some code execution in your code executionTarget: I heard you liked code execution so I put some code execution in your code executionT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.