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

-Cpanic=abort IllegalInstruction in build script #72609

Closed
Speedy37 opened this issue May 26, 2020 · 2 comments
Closed

-Cpanic=abort IllegalInstruction in build script #72609

Speedy37 opened this issue May 26, 2020 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@Speedy37
Copy link

I tried this code:

RUSTFLAGS="-Cpanic=abort"

On this repository: https://github.com/Clikengo/foundationdb-rs

I expected to see this happen: A correct build or a correct abort call

Instead, this happened: the processor reach an illegal instruction.

https://github.com/Clikengo/foundationdb-rs/runs/709083830

I was able to reproduce the crash locally on windows.
Building foundationdb-sys alone doesn't crash, but while building foundationdb-sys for foundationdb it does.

Meta

rustc --version --verbose:

rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-pc-windows-msvc
release: 1.43.1
LLVM version: 9.0
Backtrace

>	build-script-build.exe!panic_abort::__rust_start_panic()	Unknown	Non-user code. Symbols loaded.
 	build-script-build.exe!std::panicking::rust_panic() Line 522	Unknown	Symbols loaded.
 	build-script-build.exe!std::panicking::rust_panic_with_hook() Line 492	Unknown	Symbols loaded.
 	build-script-build.exe!std::panicking::begin_panic<str*>() Line 397	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!proc_macro::bridge::scoped_cell::ScopedCell<proc_macro::bridge::client::BridgeStateL>::replace() Line 74	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!proc_macro::bridge::client::{{impl}}::with::{{closure}}() Line 284	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!std::thread::local::LocalKey<proc_macro::bridge::scoped_cell::ScopedCell<proc_macro::bridge::client::BridgeStateL>>::try_with() Line 262	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!std::thread::local::LocalKey<proc_macro::bridge::scoped_cell::ScopedCell<proc_macro::bridge::client::BridgeStateL>>::with() Line 239	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!proc_macro::bridge::client::BridgeState::with() Line 283	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!proc_macro::bridge::Bridge::with() Line 314	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!proc_macro::bridge::client::Span::call_site() Line 230	Unknown	Symbols loaded.
 	build-script-build.exe!proc_macro::Span::call_site() Line 271	Unknown	Symbols loaded.
 	build-script-build.exe!core::ops::function::FnOnce::call_once<fn() -> proc_macro::Span,()>(proc_macro::Span(*)()) Line 232	Unknown	Symbols loaded.
 	build-script-build.exe!std::panicking::try::do_call<fn() -> proc_macro::Span,proc_macro::Span>(unsigned char * data) Line 303	Unknown	Symbols loaded.
 	build-script-build.exe!panic_abort::__rust_maybe_catch_panic() Line 32	Unknown	Symbols loaded.
 	build-script-build.exe!std::panicking::try<proc_macro::Span,fn() -> proc_macro::Span>(proc_macro::Span(*)() f) Line 281	Unknown	Symbols loaded.
 	build-script-build.exe!std::panic::catch_unwind<fn() -> proc_macro::Span,proc_macro::Span>(proc_macro::Span(*)() f) Line 395	Unknown	Symbols loaded.
 	build-script-build.exe!proc_macro2::detection::initialize() Line 59	Unknown	Symbols loaded.
 	build-script-build.exe!core::ops::function::FnOnce::call_once<fn(),()>(void(*)()) Line 232	Unknown	Symbols loaded.
 	build-script-build.exe!std::sync::once::{{impl}}::call_once::{{closure}}<fn()>(std::sync::once::{{impl}}::call_once::closure-0 *, bool) Line 264	Unknown	Symbols loaded.
 	build-script-build.exe!std::sync::once::Once::call_inner() Line 417	Unknown	Symbols loaded.
 	build-script-build.exe!std::sync::once::Once::call_once<fn()>(void(*)() self) Line 265	Unknown	Symbols loaded.
 	build-script-build.exe!proc_macro2::detection::inside_proc_macro() Line 15	Unknown	Symbols loaded.
 	build-script-build.exe!proc_macro2::imp::Span::call_site() Line 372	Unknown	Symbols loaded.
 	build-script-build.exe!proc_macro2::Span::call_site() Line 362	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::ir::context::BindgenContext::rust_ident_raw<alloc::borrow::Cow<str>>(alloc::borrow::Cow<str> self) Line 894	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::ir::context::BindgenContext::rust_ident<alloc::string::String*>(alloc::string::String * self) Line 887	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::codegen::{{impl}}::codegen(bindgen::ir::var::Var * self, bindgen::ir::context::BindgenContext * ctx, bindgen::codegen::CodegenResult * result, bindgen::ir::item::Item * item) Line 502	Unknown	Symbols loaded.
 	build-script-build.exe!00007ff7d1997fc1() Line 370	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::codegen::{{impl}}::codegen::{{closure}}(bindgen::codegen::{{impl}}::codegen::closure-0 * result, bindgen::codegen::CodegenResult * found_any, bool *) Line 401	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::codegen::{{impl}}::codegen(bindgen::ir::module::Module * self, bindgen::ir::context::BindgenContext * ctx, bindgen::codegen::CodegenResult * result, bindgen::ir::item::Item * item) Line 434	Unknown	Symbols loaded.
 	build-script-build.exe!00007ff7d1997f57() Line 370	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::codegen::codegen::{{closure}}(bindgen::codegen::codegen::closure-0, bindgen::ir::context::BindgenContext * context) Line 3891	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::ir::context::BindgenContext::gen<closure-0,alloc::vec::Vec<proc_macro2::TokenStream>>(bindgen::ir::context::BindgenContext self, bindgen::codegen::codegen::closure-0 cb) Line 1208	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::codegen::codegen(bindgen::ir::context::BindgenContext context) Line 3893	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::Bindings::generate(bindgen::BindgenOptions options) Line 2116	Unknown	Symbols loaded.
 	build-script-build.exe!bindgen::Builder::generate(bindgen::Builder self) Line 1423	Unknown	Symbols loaded.
 	build-script-build.exe!build_script_build::main() Line 95	Unknown	Symbols loaded.
 	build-script-build.exe!std::rt::lang_start::{{closure}}<()>(std::rt::lang_start::closure-0 *) Line 67	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!std::rt::lang_start_internal::{{closure}}() Line 52	Unknown	Symbols loaded.
 	build-script-build.exe!std::panicking::try::do_call<closure-0,i32>() Line 303	Unknown	Symbols loaded.
 	build-script-build.exe!panic_abort::__rust_maybe_catch_panic() Line 32	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!std::panicking::try() Line 281	Unknown	Symbols loaded.
 	[Inline Frame] build-script-build.exe!std::panic::catch_unwind() Line 394	Unknown	Symbols loaded.
 	build-script-build.exe!std::rt::lang_start_internal() Line 51	Unknown	Symbols loaded.
 	build-script-build.exe!std::rt::lang_start<()>(void(*)() main, __int64 argc, unsigned char * * argv) Line 67	Unknown	Symbols loaded.

@Speedy37 Speedy37 added the C-bug Category: This is a bug. label May 26, 2020
@Speedy37
Copy link
Author

Speedy37 commented May 26, 2020

Well, I guess, this is expected behavior of panic on windows.

To give a bit of context, I want to build this code with code coverage, and due to the removal of -Zno-landings-pads I was migrating to use -Cpanic=abort.

I don't know how I should resolve this problem, proc_macro2 use catch_unwind and this embeded quite deep inside the bindgen crate.

Is there a way to execute build script without -Cpanic=abort while still building the crate with -Cpanic=abort ?

@Speedy37 Speedy37 changed the title -Cpanic=abort cause STATUS_ILLEGAL_INSTRUCTION (ud2) in build script -Cpanic=abort IllegalInstruction (ud2) in build script May 26, 2020
@Speedy37 Speedy37 changed the title -Cpanic=abort IllegalInstruction (ud2) in build script -Cpanic=abort IllegalInstruction in build script May 26, 2020
@Speedy37
Copy link
Author

I guess this is cargo related rust-lang/cargo#6375

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

1 participant