diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-11-21 09:55:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-21 09:55:14 +0100 |
| commit | df552b3c24ac364802aaea6e77025110c074ddc7 (patch) | |
| tree | 3a6027ca5b4a96af5fab4fc014350218c2d1f7e9 /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | 789d168e132d3db976394a5d82490c4763c97626 (diff) | |
| parent | 3aa1954b0bfc3f10917d5ff8fa315ac3cae5c45a (diff) | |
| download | rust-df552b3c24ac364802aaea6e77025110c074ddc7.tar.gz rust-df552b3c24ac364802aaea6e77025110c074ddc7.zip | |
Rollup merge of #91070 - cuviper:insert-global, r=nagisa
Make `LLVMRustGetOrInsertGlobal` always return a `GlobalVariable` `Module::getOrInsertGlobal` returns a `Constant*`, which is a super class of `GlobalVariable`, but if the given type doesn't match an existing declaration, it returns a bitcast of that global instead. This causes UB when we pass that to `LLVMGetVisibility` which unconditionally casts the opaque argument to a `GlobalValue*`. Instead, we can do our own get-or-insert without worrying whether existing types match exactly. It's not relevant when we're just trying to get/set the linkage and visibility, and if types are needed we can bitcast or error nicely from `rustc_codegen_llvm` instead. Fixes #91050, fixes #87933, fixes #87813.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
