Skip to content
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

ThinLTO and multiple codegen units causes linking failure on Mac #45165

Closed
joshlf opened this Issue Oct 10, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@joshlf
Copy link
Contributor

joshlf commented Oct 10, 2017

Compiling the elfc crate at this commit of elfmalloc causes a linking failure with:

  • the current nightly
  • on Mac
  • with ThinLTO enabled
  • in release mode
  • with codegen-units=16

(RUSTFLAGS='-C codegen-units=16 -Z thinlto' cargo build --release)

  = note: Undefined symbols for architecture x86_64:
            "___rg_realloc", referenced from:
                ___rust_realloc in elfc.crate.allocator.rust-cgu.o
            "___rg_dealloc", referenced from:
                ___rust_dealloc in elfc.crate.allocator.rust-cgu.o
            "___rg_oom", referenced from:
                ___rust_oom in elfc.crate.allocator.rust-cgu.o
            "___rg_alloc", referenced from:
                ___rust_alloc in elfc.crate.allocator.rust-cgu.o
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Version: cargo 0.23.0-nightly (e447ac7e9 2017-09-27)

Building with cargo build --release and either of -C codegen-units=16 or -Z thinlto on their own works fine.

@joshlf joshlf changed the title ThinLTO causes linking failure on Mac ThinLTO and multiple codegen units causes linking failure on Mac Oct 10, 2017

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Oct 10, 2017

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Oct 10, 2017

Thank you for the bug report, @joshlf!

@joshlf

This comment has been minimized.

Copy link
Contributor Author

joshlf commented Oct 10, 2017

np!

alexcrichton added a commit to alexcrichton/rust that referenced this issue Oct 10, 2017

rustc: Handle `#[no_mangle]` anywhere in a crate
This commit updates the reachability pass of the compiler to seed the local
worklist with `#[no_mangle]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

alexcrichton added a commit to alexcrichton/rust that referenced this issue Oct 11, 2017

rustc: Handle `#[linkage]` anywhere in a crate
This commit updates the reachability pass of the compiler to seed the local
worklist with `#[linkage]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

kennytm added a commit to kennytm/rust that referenced this issue Oct 11, 2017

Rollup merge of rust-lang#45189 - alexcrichton:thinlto-allocators, r=…
…michaelwoerister

rustc: Handle `#[no_mangle]` anywhere in a crate

This commit updates the reachability pass of the compiler to seed the local
worklist with `#[no_mangle]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

kennytm added a commit to kennytm/rust that referenced this issue Oct 11, 2017

Rollup merge of rust-lang#45189 - alexcrichton:thinlto-allocators, r=…
…michaelwoerister

rustc: Handle `#[no_mangle]` anywhere in a crate

This commit updates the reachability pass of the compiler to seed the local
worklist with `#[no_mangle]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

kennytm added a commit to kennytm/rust that referenced this issue Oct 12, 2017

Rollup merge of rust-lang#45189 - alexcrichton:thinlto-allocators, r=…
…michaelwoerister

rustc: Handle `#[no_mangle]` anywhere in a crate

This commit updates the reachability pass of the compiler to seed the local
worklist with `#[no_mangle]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

alexcrichton added a commit to alexcrichton/rust that referenced this issue Oct 12, 2017

rustc: Handle `#[linkage]` anywhere in a crate
This commit updates the reachability pass of the compiler to seed the local
worklist with `#[linkage]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

kennytm added a commit to kennytm/rust that referenced this issue Oct 13, 2017

Rollup merge of rust-lang#45189 - alexcrichton:thinlto-allocators, r=…
…michaelwoerister

rustc: Handle `#[no_mangle]` anywhere in a crate

This commit updates the reachability pass of the compiler to seed the local
worklist with `#[no_mangle]`-like items anywhere in a crate, not just those
reachable from public items.

Closes rust-lang#45165

@bors bors closed this in #45189 Oct 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.