Skip to content

hidden symbol `_RNvCsi3tQlMvAKpb_7___rustc8___rg_oom' isn't defined #146287

@behdad

Description

@behdad

In HarfBuzz, we build a staticlib using Cargo, called libharfbuzz_rust. In lib.rs. we define a custom global allocator: https://github.com/harfbuzz/harfbuzz/blob/main/src/rust/lib.rs

We also pass -Z build-std=std,panic_abort to cargo.

We later link libharfbuzz_rust into libharfbuzz.

This used to work with nightly of 2025-09-03. But with 2025-09-5 the final link fails with:

/usr/bin/ld: src/rust/libharfbuzz_rust.a(harfbuzz_rust-d808fdb858421187.198ye9go9ghihrm4fktraojx1.rcgu.o): in function `__rustc::__rust_alloc_error_handler':
198ye9go9ghihrm4fktraojx1:(.text._RNvCsi3tQlMvAKpb_7___rustc26___rust_alloc_error_handler+0x1): undefined reference to `__rustc::__rg_oom'
/usr/bin/ld: src/libharfbuzz.so.0.61145.0: hidden symbol `_RNvCsi3tQlMvAKpb_7___rustc8___rg_oom' isn't defined
/usr/bin/ld: final link failed: bad value
clang: fatal error: linker command failed with exit code 1 (use -v to see invocation)

The build fails similarly with gcc and ld.bfd. If I try the new rust-lld, it fails also:

rust-lld: error: undefined hidden symbol: __rustc::__rg_oom
>>> referenced by 3gtrp5u97w7sjx0o9clwzaly4
>>>               harfbuzz_rust-bb6e946a41acbaf7.3gtrp5u97w7sjx0o9clwzaly4.rcgu.o:(__rustc::__rust_alloc_error_handler) in archive src/rust/libharfbuzz_rust.a
clang: fatal error: linker command failed with exit code 1 (use -v to see invocation)

If I comment out the #[global_allocator] then linking succeeds.

rustc --version --verbose:

rustc 1.91.0-nightly (6c699a372 2025-09-05)
binary: rustc
commit-hash: 6c699a37235700ab749e3f14147fe41d49c056e8
commit-date: 2025-09-05
host: x86_64-unknown-linux-gnu
release: 1.91.0-nightly
LLVM version: 21.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions