rust/src/rustllvm
bors d623ec6ba3 Auto merge of #54568 - levex:issue-54130, r=nagisa
codegen_llvm: check inline assembly constraints with LLVM

---%<---
Hey all,

As issue #54130 highlights, constraints are not checked and passing bad constraints to LLVM can crash it since a `Verify()` call is placed inside an assertion (see: `src/llvm/lib/IR/InlineAsm.cpp:39`).

As this is my first PR to the Rust compiler (woot! 🎉), there might be better ways of achieving this result. In particular, I am not too happy about generating an error in codegen; it would be much nicer if we did it earlier. However, @rkruppe [noted on IRC](https://botbot.me/mozilla/rustc/2018-09-25/?msg=104791581&page=1) that this should be fine for an unstable feature and a much better solution than the _status quo_, which is an ICE.

Thanks!
--->%---

LLVM provides a way of checking whether the constraints and the actual
inline assembly make sense. This commit introduces a check before
emitting code for the inline assembly. If LLVM rejects the inline
assembly (or its constraints), then the compiler emits an error E0668
("malformed inline assembly").

Fixes: #54130
Signed-off-by: Levente Kurusa \<lkurusa@acm.org\>
2018-09-28 09:17:28 +00:00
..
.editorconfig
ArchiveWrapper.cpp rustc_llvm: move to rustc_codegen_llvm::llvm. 2018-07-30 18:03:50 +03:00
Linker.cpp
llvm-rebuild-trigger Update LLVM to fix "bool" arguments on PPC32 2018-09-16 04:33:58 +08:00
PassWrapper.cpp add -Z emit-stack-sizes 2018-09-26 15:21:26 +02:00
README
rustllvm.h
RustWrapper.cpp codegen_llvm: check inline assembly constraints with LLVM 2018-09-25 20:38:35 +02:00

This directory currently contains some LLVM support code. This will generally
be sent upstream to LLVM in time; for now it lives here.

NOTE: the LLVM C++ ABI is subject to between-version breakage and must *never*
be exposed to Rust. To allow for easy auditing of that, all Rust-exposed types
must be typedef-ed as "LLVMXyz", or "LLVMRustXyz" if they were defined here.

Functions that return a failure status and leave the error in
the LLVM last error should return an LLVMRustResult rather than an
int or anything to avoid confusion.

When translating enums, add a single `Other` variant as the first
one to allow for new variants to be added. It should abort when used
as an input.

All other types must not be typedef-ed as such.