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

error: <inline asm>:11:1: this directive must appear between .cfi_startproc and .cfi_endproc directives #41

Closed
xobs opened this issue Dec 13, 2024 · 5 comments · Fixed by #42

Comments

@xobs
Copy link
Contributor

xobs commented Dec 13, 2024

The latest version of nightly Rust has started producing the error mentioned above:

   Compiling unwinding v0.2.4
error: <inline asm>:11:1: this directive must appear between .cfi_startproc and .cfi_endproc directives
.cfi_def_cfa_offset 0x90
^

error: could not compile `unwinding` (lib)

Caused by:
  process didn't exit successfully: `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name unwinding --edition=2021 /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unwinding-0.2.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="fde-custom"' --cfg 'feature="rustc-dep-of-std"' --cfg 'feature="unwinder"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("alloc", "compiler_builtins", "core", "default", "dwarf-expr", "fde-custom", "fde-gnu-eh-frame-hdr", "fde-phdr", "fde-phdr-aux", "fde-phdr-dl", "fde-registry", "fde-static", "hide-trace", "libc", "panic", "panic-handler", "panic-handler-dummy", "panicking", "personality", "personality-dummy", "print", "rustc-dep-of-std", "spin", "system-alloc", "unwinder"))' -C metadata=b255928c0957c633 -C extra-filename=-1ee460f01ef04a46 --out-dir /home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/riscv32imac-unknown-xous-elf/release/deps --target riscv32imac-unknown-xous-elf -C strip=debuginfo -L dependency=/home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/riscv32imac-unknown-xous-elf/release/deps -L dependency=/home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/release/deps --extern compiler_builtins=/home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/riscv32imac-unknown-xous-elf/release/deps/libcompiler_builtins-6590f15bf048bb62.rmeta --extern gimli=/home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/riscv32imac-unknown-xous-elf/release/deps/libgimli-dac8086df33c8820.rmeta --extern core=/home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/riscv32imac-unknown-xous-elf/release/deps/librustc_std_workspace_core-787d5f62566a54af.rmeta --cap-lints allow -Cforce-unwind-tables=yes -Cembed-bitcode=yes -Zforce-unstable-if-unmarked=yes -Z binary-dep-depinfo -L native=/home/runner/work/rust-nightly/rust-nightly/build/rust/library/target/riscv32imac-unknown-xous-elf/release/build/compiler_builtins-463ae0a77e7dd83f/out` (exit status: 1)

This can be reproduced by installing the latest Rust nightly (d4025ee45 as of this issue) and running the following on the appropriate rust source tree:

user@ubuntu:/opt/Xous/rust-nightly/rust$ RUST_COMPILER_RT_ROOT="$(pwd)/src/llvm-project/compiler-rt" RUSTFLAGS="-Cforce-unwind-tables=yes -Cembed-bitcode=yes" cargo +nightly build --target riscv32imac-unknown-xous-elf -Zbinary-dep-depinfo --release --features "panic-unwind compiler-builtins-c compiler-builtins-mem" --manifest-path "library/sysroot/Cargo.toml"
   Compiling shlex v1.3.0
   Compiling core v0.0.0 (/opt/Xous/rust-nightly/rust/library/core)
   Compiling libc v0.2.167
   Compiling std v0.0.0 (/opt/Xous/rust-nightly/rust/library/std)
   Compiling cc v1.2.0
   Compiling compiler_builtins v0.1.138
   Compiling rustc-std-workspace-core v1.99.0 (/opt/Xous/rust-nightly/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/opt/Xous/rust-nightly/rust/library/alloc)
   Compiling cfg-if v1.0.0
   Compiling rustc-demangle v0.1.24
   Compiling dlmalloc v0.2.7
   Compiling rustc-std-workspace-alloc v1.99.0 (/opt/Xous/rust-nightly/rust/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/opt/Xous/rust-nightly/rust/library/panic_abort)
   Compiling gimli v0.31.1
   Compiling std_detect v0.1.5 (/opt/Xous/rust-nightly/rust/library/stdarch/crates/std_detect)
   Compiling hashbrown v0.15.2
   Compiling unwinding v0.2.4
   Compiling unwind v0.0.0 (/opt/Xous/rust-nightly/rust/library/unwind)
   Compiling panic_unwind v0.0.0 (/opt/Xous/rust-nightly/rust/library/panic_unwind)
error: <inline asm>:11:1: this directive must appear between .cfi_startproc and .cfi_endproc directives
.cfi_def_cfa_offset 0x90
^

error: could not compile `unwinding` (lib)

Caused by:
  process didn't exit successfully: `/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name unwinding --edition=2021 /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unwinding-0.2.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=120 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="fde-custom"' --cfg 'feature="rustc-dep-of-std"' --cfg 'feature="unwinder"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("alloc", "compiler_builtins", "core", "default", "dwarf-expr", "fde-custom", "fde-gnu-eh-frame-hdr", "fde-phdr", "fde-phdr-aux", "fde-phdr-dl", "fde-registry", "fde-static", "hide-trace", "libc", "panic", "panic-handler", "panic-handler-dummy", "panicking", "personality", "personality-dummy", "print", "rustc-dep-of-std", "spin", "system-alloc", "unwinder"))' -C metadata=a330dcc068565f04 -C extra-filename=-26ed38c42d75d551 --out-dir /opt/Xous/rust-nightly/rust/library/target/riscv32imac-unknown-xous-elf/release/deps --target riscv32imac-unknown-xous-elf -C strip=debuginfo -L dependency=/opt/Xous/rust-nightly/rust/library/target/riscv32imac-unknown-xous-elf/release/deps -L dependency=/opt/Xous/rust-nightly/rust/library/target/release/deps --extern compiler_builtins=/opt/Xous/rust-nightly/rust/library/target/riscv32imac-unknown-xous-elf/release/deps/libcompiler_builtins-8a32899bd86d6b95.rmeta --extern gimli=/opt/Xous/rust-nightly/rust/library/target/riscv32imac-unknown-xous-elf/release/deps/libgimli-205974f5690a8539.rmeta --extern core=/opt/Xous/rust-nightly/rust/library/target/riscv32imac-unknown-xous-elf/release/deps/librustc_std_workspace_core-bbdc3c0e2b4ffb58.rmeta --cap-lints allow -Cforce-unwind-tables=yes -Cembed-bitcode=yes -Z binary-dep-depinfo -L native=/opt/Xous/rust-nightly/rust/library/target/riscv32imac-unknown-xous-elf/release/build/compiler_builtins-8420e0cd54597b2e/out` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
user@ubuntu:/opt/Xous/rust-nightly/rust$
@nbdd0121
Copy link
Owner

This is a rustc regression. Would you mind filing an issue to rust-lang/rust?

@folkertdev
Copy link

@nbdd0121 as the crate author you could emit the .cfi_startproc and .cfi_endproc directives yourself. Is there a particular reason to expect the compiler to do it for you for naked functions? (note: I don't know one way or the other, I'm just trying to find out how this should work)

@xobs
Copy link
Contributor Author

xobs commented Dec 14, 2024

I noticed you mentioned it on that PR, and there was a comment saying it was "working as intended". Would you still like me to open an issue?

@xobs
Copy link
Contributor Author

xobs commented Dec 17, 2024

Since rustc says this is as designed, I've opened #42 to address it. However, as mentioned in rust-lang/rust#80608 unwinding no longer passes CI.

@xobs
Copy link
Contributor Author

xobs commented Dec 17, 2024

#42 now passes with the addition of the fix suggested in rust-lang/rust#134403 (comment)

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