Skip to content

Stack overflow in rustc when trying to make bare metal executable #20918

Closed
@jacquesf

Description

@jacquesf

I’m playing with making a bare-metal executable in rust. I fully admit to not knowing what I’m doing, but I thought this was worth reporting given that it resulted in a stack overflow in rustc. This was produced with the rust nightly from 2014/1/10. I’m on OS X 10.10.1 and installed rustc from the OS X .pkg flle.

Here’s how I invoked the compiler:

$ rustc spin.rs
spin.rs:4:1: 4:19 warning: use of unstable item, #[warn(unstable)] on by default
spin.rs:4 extern crate core;
          ^~~~~~~~~~~~~~~~~~

thread 'rustc' has overflowed its stack
Illegal instruction: 4

Here’s spin.rs:

#![feature(lang_items)]
#![no_std]

extern crate core;

use core::fmt::Arguments;

#[lang="stack_exhausted"]
extern fn stack_exhausted() {}

#[lang="eh_personality"]
extern fn eh_personality() {}

#[lang="begin_unwind"]
extern fn begin_unwind() {}

#[lang="panic_fmt"]
pub fn panic_fmt(_fmt: &Arguments, _file_line: &(&'static str, usize)) -> ! {
  loop { }
}

#[lang="start"]
fn main() {
    loop {
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions