Skip to content

'undefined reference to __morestack' when compiling with -O #15108

Closed
@ebfe

Description

@ebfe
fn main() {}
$ rustc t.rs
$ rustc -O t.rs
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib' '-o' 't' 't.o' '-lmorestack' '-nodefaultlibs' '-Wl,--gc-sections' '-Wl,--as-needed' '-Wl,-O1' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-59beb4f7-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libsync-305341d2-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustrt-d8560cb2-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-2ea8f361-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-d412c0c4-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1085c790-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c5ed6fb4-0.11.0-pre.rlib' '/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-4f9a876d-0.11.0-pre.rlib' '-L' '/home/mg/.rust' '-L' '/home/mg' '-Wl,-Bdynamic' '-ldl' '-lpthread' '-lgcc_s' '-lpthread' '-lc' '-lm' '-Wl,-rpath,$ORIGIN/../../usr/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib' '-lcompiler-rt'
note: /usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib(native.o): In function `io::helper_thread::imp::new::h69049da469566067Aga::v0.11.0.pre':
(.text._ZN2io13helper_thread3imp3new20h69049da469566067Aga11v0.11.0.preE+0x20): undefined reference to `__morestack'
/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib(native.o): In function `io::helper_thread::imp::signal::h13cdde7c153bbf21Vga::v0.11.0.pre':
(.text._ZN2io13helper_thread3imp6signal20h13cdde7c153bbf21Vga11v0.11.0.preE+0x20): undefined reference to `__morestack'
/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib(native.o): In function `io::file::FileDesc::inner_write::h2c415f6b9c18fc02zuc::v0.11.0.pre':
(.text._ZN2io4file8FileDesc11inner_write20h2c415f6b9c18fc02zuc11v0.11.0.preE+0x20): undefined reference to `__morestack'
/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib(native.o): In function `io::file::FileDesc::new::h56aff56801c246e39sc::v0.11.0.pre':
(.text._ZN2io4file8FileDesc3new20h56aff56801c246e39sc11v0.11.0.preE+0x20): undefined reference to `__morestack'
/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib(native.o): In function `io..file..FileDesc::glue_drop.4662::h71b0d96b8d3b9466':
(.text._ZN18io..file..FileDesc14glue_drop.466217h71b0d96b8d3b9466E+0x20): undefined reference to `__morestack'
/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-1fb5e2c0-0.11.0-pre.rlib(native.o):(.text._ZN2io8addrinfo18GetAddrInfoRequest3run20h8447a365fad4be72Kha11v0.11.0.preE+0x28): more undefined references to `__morestack' follow
collect2: error: ld returned 1 exit status

error: aborting due to previous error

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