-
Notifications
You must be signed in to change notification settings - Fork 26
fix: resolve ABI generation failure for contracts with unguarded #[no_mangle] functions #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -69,20 +69,28 @@ pub fn procedure( | |||||||||||||||||||
|
|
||||||||||||||||||||
| pretty_print::step("Generating ABI"); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| let compile_env = { | ||||||||||||||||||||
| let compile_env = vec![ | ||||||||||||||||||||
| let (compile_env, hide_warnings_for_compile) = { | ||||||||||||||||||||
| let mut compile_env = vec![ | ||||||||||||||||||||
| ("CARGO_PROFILE_DEV_OPT_LEVEL", "0"), | ||||||||||||||||||||
| ("CARGO_PROFILE_DEV_DEBUG", "0"), | ||||||||||||||||||||
| ("CARGO_PROFILE_DEV_LTO", "off"), | ||||||||||||||||||||
| (env_keys::BUILD_RS_ABI_STEP_HINT, "true"), | ||||||||||||||||||||
| ]; | ||||||||||||||||||||
| [&compile_env, env].concat() | ||||||||||||||||||||
| compile_env.extend_from_slice(env); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| let mut hide_warnings_for_compile = hide_warnings; | ||||||||||||||||||||
| if let Some(rustflags) = abi_generation_rustflags(hide_warnings) { | ||||||||||||||||||||
| compile_env.push((env_keys::RUSTFLAGS, rustflags)); | ||||||||||||||||||||
| hide_warnings_for_compile = false; | ||||||||||||||||||||
|
Comment on lines
+82
to
+84
|
||||||||||||||||||||
| if let Some(rustflags) = abi_generation_rustflags(hide_warnings) { | |
| compile_env.push((env_keys::RUSTFLAGS, rustflags)); | |
| hide_warnings_for_compile = false; | |
| let has_rustflags_override = env.iter().any(|(key, _)| *key == env_keys::RUSTFLAGS); | |
| if !has_rustflags_override { | |
| if let Some(rustflags) = abi_generation_rustflags(hide_warnings) { | |
| compile_env.push((env_keys::RUSTFLAGS, rustflags)); | |
| hide_warnings_for_compile = false; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load_near_host_function_stubs()is executed on every ABI extraction on Unix, which means spawningrustcand compiling a cdylib even when the target dylib has no unresolved host symbols. This adds noticeable overhead tocargo near abi/cargo near build(and to integration tests) and may also complicate environments with restricted process spawning. Consider compiling/loading the stubs lazily only whendlopenfails due to an undefined symbol, or caching the compiled+loaded stubs with aOnceLockso it happens at most once per process.