Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cumulus/polkadot-omni-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#![warn(missing_docs)]
#![warn(unused_extern_crates)]

// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
#[cfg(target_os = "linux")]
extern crate polkadot_jemalloc_shim;

use polkadot_omni_node_lib::{
chain_spec::DiskChainSpecLoader, extra_subcommand::NoExtraSubcommand, run_with_custom_cli,
runtime::DefaultRuntimeResolver, CliConfig as CliConfigT, RunConfig, NODE_VERSION,
Expand Down
4 changes: 4 additions & 0 deletions cumulus/polkadot-parachain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#![warn(missing_docs)]
#![warn(unused_extern_crates)]

// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
#[cfg(target_os = "linux")]
extern crate polkadot_jemalloc_shim;

mod chain_spec;

use polkadot_omni_node_lib::{
Expand Down
4 changes: 4 additions & 0 deletions polkadot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#![warn(missing_docs)]

// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
#[cfg(target_os = "linux")]
extern crate polkadot_jemalloc_shim;

use color_eyre::eyre;

fn main() -> eyre::Result<()> {
Expand Down
19 changes: 19 additions & 0 deletions prdoc/pr_11114.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
title: 'Force the linker not to drop jemalloc shim on Linux'
doc:
- audience: Runtime Dev
description: "Force the linker to keep the polkadot_jemalloc_shim crate and its\
\ #[global_allocator] in all binaries that depend on it. Without it, the linker\
\ might drop it since it is seen as a dependency with no referenced symbols.\
\ The issue happens only on a subset of combination of rust version and linker\
\ (e.g. on CI with Ubuntu 24.04, rust 1.88.0 + gcc/ld strips the jemalloc crate\
\ from the binary but not rust 1.92.0, and also rust 1.88.0 + clang/mold works\
\ fine).\n"
crates:
- name: frame-omni-bencher
bump: patch
- name: polkadot
bump: patch
- name: polkadot-parachain-bin
bump: patch
- name: polkadot-omni-node
bump: patch
4 changes: 4 additions & 0 deletions substrate/utils/frame/omni-bencher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

mod command;

// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
#[cfg(target_os = "linux")]
extern crate polkadot_jemalloc_shim;

use clap::Parser;
use sc_cli::Result;
use tracing_subscriber::EnvFilter;
Expand Down
Loading