Skip to content

[E0668] Malformed inline assembly when building rustc #54918

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
varkor opened this issue Oct 8, 2018 · 4 comments
Closed

[E0668] Malformed inline assembly when building rustc #54918

varkor opened this issue Oct 8, 2018 · 4 comments

Comments

@varkor
Copy link
Member

varkor commented Oct 8, 2018

When running ./x.py build --stage 1, I now get the error:

error[E0668]: malformed inline assembly=======>                        ] 16/27: compiler_builtins                                                                                                           
  --> rustc/compiler_builtins_shim/../../libcompiler_builtins/src/probestack.rs:55:5
   |
55 | /     asm!("
56 | |         mov    %rax,%r11        // duplicate %rax as we're clobbering %r11
57 | |
58 | |         // Main loop, taken in one page increments. We're decrementing rsp by
...  |
92 | |         ret
93 | |     " ::: "memory" : "volatile");
   | |_________________________________^

error: aborting due to previous error

I'm on macOS 10.12.6. This error was added recently (#54568), but it suggests there's been a problem for longer.

@varkor
Copy link
Member Author

varkor commented Oct 8, 2018

And here:

error[E0668]: malformed inline assembly============================>   ] 26/27: std                                                                                                                         
  --> ~/GitHub/rust/src/libcore/../stdsimd/coresimd/x86/cpuid.rs:64:9
   |
64 | /         asm!("cpuid\n"
65 | |              : "={eax}"(r.eax), "={ebx}"(r.ebx), "={ecx}"(r.ecx), "={edx}"(r.edx)
66 | |              : "{eax}"(leaf), "{ecx}"(sub_leaf)
67 | |              : "rbx" :);
   | |________________________^

error[E0668]: malformed inline assembly
  --> ~/GitHub/rust/src/libcore/../stdsimd/coresimd/x86/xsave.rs:91:5
   |
91 |     asm!("xgetbv" : "={eax}"(eax), "={edx}"(edx) : "{ecx}"(xcr_no));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

@dsciarra
Copy link
Contributor

dsciarra commented Oct 9, 2018

OK on macOS 10.14

@levex
Copy link
Contributor

levex commented Oct 12, 2018

Hmm, I added that error code, and I find that pretty odd. Sadly, I am unable to reproduce this on Linux and I don’t have access to a macOS machine right now.

The error code is emitted if we pass the inline assembly (with its constraints) to LLVM and for some reason it rejects it. (that is, the function InlineAsm::Verify returns false in src/llvm/lib/IR/InlineAsm.cpp. If you have access to the rust source code (which you do since you are trying to get it to compile :p ), it would be appreciated if added a few printfs around the return false; statements in the above mentioned file. That way, we could pinpoint why LLVM rejected these seemingly valid inline assembly statements.

Thanks!

@varkor
Copy link
Member Author

varkor commented Oct 16, 2018

Okay, this is strange. InlineAsm::Verify is returning true and yet the malformed assembly message is still being output. I've found the problem, but not what's causing it:

let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons);
debug!("Constraint verification result: {:?}", constraints_ok);

constraints_ok is 769 here.

kennytm added a commit to kennytm/rust that referenced this issue Oct 18, 2018
…rn-bool, r=rkruppe

Fix LLVMRustInlineAsmVerify return type mismatch

Fixes rust-lang#54918.

r? @rkruppe
cc @levex
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

No branches or pull requests

3 participants