Skip to content

Commit 022ec72

Browse files
paritytech-release-backport-bot[bot]sigurpolgithub-actions[bot]bkchr
authored
[stable2603] Backport #11114 (#11119)
Backport #11114 into `stable2603` from sigurpol. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> Co-authored-by: Paolo La Camera <paolo@parity.io> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de>
1 parent 343a04d commit 022ec72

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

cumulus/polkadot-omni-node/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#![warn(missing_docs)]
2222
#![warn(unused_extern_crates)]
2323

24+
// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
25+
#[cfg(target_os = "linux")]
26+
extern crate polkadot_jemalloc_shim;
27+
2428
use polkadot_omni_node_lib::{
2529
chain_spec::DiskChainSpecLoader, extra_subcommand::NoExtraSubcommand, run_with_custom_cli,
2630
runtime::DefaultRuntimeResolver, CliConfig as CliConfigT, RunConfig, NODE_VERSION,

cumulus/polkadot-parachain/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#![warn(missing_docs)]
2020
#![warn(unused_extern_crates)]
2121

22+
// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
23+
#[cfg(target_os = "linux")]
24+
extern crate polkadot_jemalloc_shim;
25+
2226
mod chain_spec;
2327

2428
use polkadot_omni_node_lib::{

polkadot/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
1919
#![warn(missing_docs)]
2020

21+
// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
22+
#[cfg(target_os = "linux")]
23+
extern crate polkadot_jemalloc_shim;
24+
2125
use color_eyre::eyre;
2226

2327
fn main() -> eyre::Result<()> {

prdoc/pr_11114.prdoc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
title: 'Force the linker not to drop jemalloc shim on Linux'
2+
doc:
3+
- audience: Runtime Dev
4+
description: "Force the linker to keep the polkadot_jemalloc_shim crate and its\
5+
\ #[global_allocator] in all binaries that depend on it. Without it, the linker\
6+
\ might drop it since it is seen as a dependency with no referenced symbols.\
7+
\ The issue happens only on a subset of combination of rust version and linker\
8+
\ (e.g. on CI with Ubuntu 24.04, rust 1.88.0 + gcc/ld strips the jemalloc crate\
9+
\ from the binary but not rust 1.92.0, and also rust 1.88.0 + clang/mold works\
10+
\ fine).\n"
11+
crates:
12+
- name: frame-omni-bencher
13+
bump: patch
14+
- name: polkadot
15+
bump: patch
16+
- name: polkadot-parachain-bin
17+
bump: patch
18+
- name: polkadot-omni-node
19+
bump: patch

substrate/utils/frame/omni-bencher/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
mod command;
1919

20+
// Force the linker to keep the polkadot_jemalloc_shim crate (and its #[global_allocator]).
21+
#[cfg(target_os = "linux")]
22+
extern crate polkadot_jemalloc_shim;
23+
2024
use clap::Parser;
2125
use sc_cli::Result;
2226
use tracing_subscriber::EnvFilter;

0 commit comments

Comments
 (0)