diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-29 22:43:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-29 22:43:19 +0100 |
| commit | 581ca3e836083bfbb2da888809d3ea16a4440c94 (patch) | |
| tree | 82d882263b78a6a52685db542e832375c5d4e4e6 /compiler/rustc_passes/src | |
| parent | 804fa66a027a5813a30197bef9da5afb1dc104a9 (diff) | |
| parent | 63915be212d0c054c764b7dd5c408e2c10af219c (diff) | |
| download | rust-581ca3e836083bfbb2da888809d3ea16a4440c94.tar.gz rust-581ca3e836083bfbb2da888809d3ea16a4440c94.zip | |
Rollup merge of #105023 - tmiasko:asm-sym-static-reachable, r=wesleywiser
Statics used in reachable function's inline asm are reachable Fixes #104925.
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/reachable.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 73ea06a6370..e7c3c712852 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -116,6 +116,17 @@ impl<'tcx> Visitor<'tcx> for ReachableContext<'tcx> { intravisit::walk_expr(self, expr) } + + fn visit_inline_asm(&mut self, asm: &'tcx hir::InlineAsm<'tcx>, id: hir::HirId) { + for (op, _) in asm.operands { + if let hir::InlineAsmOperand::SymStatic { def_id, .. } = op { + if let Some(def_id) = def_id.as_local() { + self.reachable_symbols.insert(def_id); + } + } + } + intravisit::walk_inline_asm(self, asm, id); + } } impl<'tcx> ReachableContext<'tcx> { |
