-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
CFI: Append debug location to CFI blocks #132702
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in tests/codegen/sanitizer cc @rust-lang/project-exploit-mitigations, @rcvalle Some changes occurred in compiler/rustc_codegen_gcc |
@@ -222,7 +222,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |||
} | |||
} | |||
|
|||
fn dbg_loc(&self, source_info: mir::SourceInfo) -> Option<Bx::DILocation> { | |||
pub fn dbg_loc(&self, source_info: mir::SourceInfo) -> Option<Bx::DILocation> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to point out: I need to turn a mir::SourceInfo
into a Bx::DILocation
and this was the only place I found that does that. I just marked the function public to also use it when generating the block (compiler/rustc_codegen_ssa/src/mir/block.rs
), I hope that is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is this should be fine (cc @compiler-errors).
r? @rcvalle |
Thank you for your time and for working on this, @1c3t3a ! Much appreciated. Alternatively, this could be implemented by passing back/returning the blocks created by CFI to rustc_codegen_ssa if any, but I'm OK with this implementation. I think invoke and call need some refactoring (and possibly being consolidated into one) anyway, and from past conversations with @bjorn3 seemed to agree, and might be interested in providing feedback here. Otherwise; LGTM (FYI @cuviper). |
Currently we're not appending debug locations to the inserted CFI blocks. This shows up in #132615 and #100783. This change fixes that by passing down the debug location to the CFI type-test generation and appending it to the blocks.