Skip to content

Undefined reference to `__morestack' when compiling with -O #13625

Closed
@sebcrozet

Description

@sebcrozet

Since I updated the compiler to:

rustc 0.11-pre (2c22ae4 2014-04-19 04:26:28 -0700)
host: x86_64-unknown-linux-gnu

the following code:

extern crate native;

#[start]
fn start(argc: int, argv: **u8) -> int {
    native::start(argc, argv, main)
}

fn main() {
}

fails to compile with optimizations on:

rustc -O test.rs
error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-o' 'test' 'test.o' '-lmorestack' '-nodefaultlibs' '-Wl,--as-needed' '-Wl,-O1' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-aad93cea-0.11-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-3574b280-0.11-pre.rlib' '-L.' '-L/home/tortue/trash/.rust' '-L/home/tortue/trash' '-L/home/tortue/.rust' '-Wl,-Bdynamic' '-ldl' '-lpthread' '-lgcc_s' '-lc' '-lm' '-Wl,-rpath,$ORIGIN/../../../usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lcompiler-rt'
note: /usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib(native.o): In function `io::addrinfo::GetAddrInfoRequest::run::ha9bf714109bfa7af1aa::v0.11.pre':
native.rs:(.text+0x28): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib(native.o): In function `fmt::secret_string::h10210563234607143262::v0.11.pre':
native.rs:(.text+0xda0): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib(native.o): In function `rt::unwind::begin_unwind::h2680316326101838750::v0.11.pre':
native.rs:(.text+0xe00): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib(native.o): In function `any::T.Any::get_type_id::h10127464687270589723::v0.11.pre':
native.rs:(.text+0xe90): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib(native.o): In function `io::net::sockaddr_to_addr::h1c5b17f236d8b4feAsa::v0.11.pre':
native.rs:(.text+0xed0): undefined reference to `__morestack'
/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-83574243-0.11-pre.rlib(native.o):native.rs:(.text+0x1160): more undefined references to `__morestack' follow
collect2: error: ld returned 1 exit status

error: aborting due to previous error

Compiling without -O does work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions