Skip to content

regression under openbsd: undefined reference to _Unwind_Resume #24108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
semarie opened this issue Apr 6, 2015 · 4 comments · Fixed by #24425
Closed

regression under openbsd: undefined reference to _Unwind_Resume #24108

semarie opened this issue Apr 6, 2015 · 4 comments · Fixed by #24425

Comments

@semarie
Copy link
Contributor

semarie commented Apr 6, 2015

I have noted a regression in make check starting from 263fdfe (found with bisect).

the failing test is one of doc-trpl-no-stdlib. The fail occurs with stage1 and with stage2 (it have help a lot for bisect: only 50 min for 1 step of bisect)

I extract the example to a standalone file, and manually run rustc: the error is a linking error:

original.o(.text._ZN6option15Option$LT$T$GT$8and_then21h10563965396030871015E+0xa0): In function `option::Option$LT$T$GT$::and_then::h10563965396030871015': undefined reference to `_Unwind_Resume'

it seems -lgcc isn't passed by rustc, whereas the symbol _Unwind_Resume was present in option::Option<T>::and_then.

Any help would be appreciate.

@Virtlink
Copy link

I have the same issue. It worked fine in nightly c89de2c (2015-03-28), but now in nightly 47def3e (2015-04-13) I get these errors when trying to link my standalone kernel with libcore:

libkernel-7b2dcbc423fd2cc0.a(r-core-core-bffd6497cd08eb80.o):
In function `core::option::Option<T>::and_then<(&core::fmt::ArgumentV1, &&str),closure>':
libcore/src/option.rs:627: undefined reference to `_Unwind_Resume'
In function `core::option::Option<T>::and_then<(&core::fmt::rt::v1::Argument, &&str),closure>':
libcore/src/option.rs:627: undefined reference to `_Unwind_Resume'

It only happens when I use my custom target.json:

{
    "data-layout": "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128",
    "llvm-target": "x86_64-unknown-linux-gnu",
    "target-endian": "little",
    "target-pointer-width": "64",
    "os": "orion",
    "arch": "x86_64",
    "pre-link-args": ["-m64"],
    "no-compiler-rt": true,
    "disable-redzone": true,
    "eliminate-frame-pointer": false,
    "morestack": false
}

If I try to add _Unwind_Resume manually:

#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn _Unwind_Resume(_ex_obj: *mut ()) { }

...Rust gives me this error instead:

src/lib.rs:118:1: 118:55 error: symbol `_Unwind_Resume` is already defined
src/lib.rs:118 pub extern "C" fn _Unwind_Resume(_ex_obj: *mut ()) { }
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is there a solution or workaround?


rustc 1.0.0-nightly (47def3ef2 2015-04-13) (built 2015-04-13)
binary: rustc
commit-hash: 47def3ef27a2e027f1a93ef7870ff131ee7926fd
commit-date: 2015-04-13
build-date: 2015-04-13
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly

@semarie
Copy link
Contributor Author

semarie commented Apr 13, 2015

@Virtlink you could try to explicitly link with libgcc by providing -lgcc on rustc command-line.

@Virtlink
Copy link

@semarie Can that be done through Cargo too? As I've only used Cargo up to now.

@semarie
Copy link
Contributor Author

semarie commented Apr 13, 2015

I really don't known... (I don't have cargo on openbsd). You could try to add
#[link(name="gcc")] in your file.

Manishearth added a commit to Manishearth/rust that referenced this issue Apr 15, 2015
…excrichton

the code block in the no-stdlib.md file caused test failure on bitrig and openbsd.

Closes rust-lang#24108
Manishearth added a commit to Manishearth/rust that referenced this issue Apr 15, 2015
…excrichton

the code block in the no-stdlib.md file caused test failure on bitrig and openbsd.

Closes rust-lang#24108
steveklabnik added a commit to steveklabnik/rust that referenced this issue Apr 15, 2015
…excrichton

the code block in the no-stdlib.md file caused test failure on bitrig and openbsd.

Closes rust-lang#24108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants