Skip to content

LLVM ERROR: Unexpected anonymous function when writing summary #51947

@japaric

Description

@japaric
Member

When compiling the compiler_builtins crate for any of the thumb targets in release mode and with debuginfo enabled. Without debuginfo the build succeeds (we are testing this by building rust-std for the thumb targets). This doesn't affect the ARM Linux targets.

STR

$ cp -r $(rustc --print sysroot)/lib/rustlib/src/rust/src/ src && cd $_

$ cd libcompiler_builtins

$ cat >>Cargo.toml <<'EOF'
[profile.release]
debug = true
EOF

$ cargo build --target thumbv7m-none-eabi --release
LLVM ERROR: Unexpected anonymous function when writing summary

Metadata

$ rustc -V
rustc 1.28.0-nightly (e3bf634e0 2018-06-28)

Needs bisecting

cc @alexcrichton

Activity

added
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
on Jun 30, 2018
Mark-Simulacrum

Mark-Simulacrum commented on Jun 30, 2018

@Mark-Simulacrum
Member
$ cargo-bisect-rustc --start 56714acc5eb0687ed9a7566fdebe5528657fc5b3 --target thumbv7m-none-eabi --prompt --test-dir case/src/libcompiler_builtins --by-commit  -- build --target thumbv7m-none-eabi --release

searched toolchains 56714acc5eb0687ed9a7566fdebe5528657fc5b3 through 96b47337d9deebdb9cbca909e7772672062021e5
regression in e1151c9819cca90e511f60757297629177272d16

e1151c9 - #49479 - cc @nagisa @nox

nikic

nikic commented on Jun 30, 2018

@nikic
Contributor

Could this be hitting the case where linking is performed without thinlto, but bitcode is still being written through thinlto buffers? It might be worth trying to apply these changes and see if it fixes the issue: https://github.com/rust-lang/rust/pull/51007/files#diff-a3c60982b42eac1d2e3fd67f4d562ae8R550

nagisa

nagisa commented on Jun 30, 2018

@nagisa
Member

Yeah, the error message definitely sounds related to thinlto. At least "summary" is a thinlto concept.

That being said, it doesn’t seem like thinlto is disabled anywhere in the original report, so…

agalakhov

agalakhov commented on Jul 21, 2018

@agalakhov

I just tried it with "-Z thinlto=no", and it does NOT help.

aribeironovaes

aribeironovaes commented on Sep 1, 2018

@aribeironovaes

Hi @japaric ,

Did you figure our how to fix this issue?
I'm trying to run cortex-m-quickstart on a STM32L475 and I'm getting Stuck on the LLVM ERROR: Unexpected anonymous function when writing summary error if debug = true.

Can you let me know if you could successfully run the sample on this version of Cortex M4?

Thanks lot in advance,

Angelo Ribeiro.

maximevince

maximevince commented on Nov 1, 2018

@maximevince

Same problem here! Any solution or workaround known?

nikic

nikic commented on Nov 1, 2018

@nikic
Contributor

Running with -C lto=thin worked for me, so I think my general guess in #51947 (comment) was right -- unfortunately the linked patch has landed in the meantime and has not fixed the issue. rustc is being run with --crate-type lib --emit=dep-info,link here, I'll have to check what exactly that means for bitcode emission.

nikic

nikic commented on Nov 1, 2018

@nikic
Contributor

Here is a reproducer without the compiler_builtins/thumb dependency:

#![feature(linkage)]
  
#[linkage = "weak"]
pub fn fn1(a: u32, b: u32, c: u32) -> u32 {
    a + b + c
}

#[linkage = "weak"]
pub fn fn2(a: u32, b: u32, c: u32) -> u32 {
    a + b + c
}

Compiled with --crate-type=rlib -O this produces the anon function error.

added a commit that references this issue on Nov 6, 2018
66702fc
added a commit that references this issue on Nov 7, 2018
dfa104e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.WG-embeddedWorking group: Embedded systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nikic@nagisa@agalakhov@maximevince@japaric

        Issue actions

          LLVM ERROR: Unexpected anonymous function when writing summary · Issue #51947 · rust-lang/rust