Skip to content

__rust_probestack in binary despite no callers, LTO, and disabling stack-probes. #88274

Open
@daxtens

Description

@daxtens

I'm finding that __rust_probestack appears in static libraries created by rust for a custom x86_64 target, even when the target specifies "stack-probes": { "kind": "none" }, LTO is enabled, and there are no callers of __rust_probestack

I tried to build the following code:

#![no_std]

use core::panic::PanicInfo;

pub fn foo() {}

#[panic_handler]
fn panic(_panic: &PanicInfo<'_>) -> ! {
    loop {}
}

With the following set in Cargo.toml:

[lib]
crate_type = ["staticlib"]

[profile.release]
lto = true

And the following cargo invocation:

cargo +nightly build --release -Zbuild-std=core,alloc --target target.json

target.json is attached.

I expected to see no instance of __rust_probestack in the generated output.

Instead I see:

objdump -d target/target/release/liblto_issue.a|head
In archive target/target/release/liblto_issue.a:

lto_issue-7670395b8b30746c.lto_issue.e6cad5ce-cgu.0.rcgu.o:     file format elf64-x86-64


Disassembly of section .text.__rust_probestack:

0000000000000000 <__rust_probestack>:
   0:	55                   	push   %rbp
   1:	48 89 e5             	mov    %rsp,%rbp

Meta

rustc +nightly --version --verbose:

rustc 1.56.0-nightly (af140757b 2021-08-22)
binary: rustc
commit-hash: af140757b4cb1a60d107c690720311ba8e06e7de
commit-date: 2021-08-22
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 13.0.0

target.json.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-stack-probeArea: Stack probing and guard pagesC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions