[PATCH] [asan-asm-instrumentation] CFI directives are generated for .S files.

Yuri Gorshenin ygorshenin at chromium.org
Wed Oct 1 05:11:26 PDT 2014


PTAL

================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:579
@@ +578,3 @@
+    const MCRegisterInfo *MRI = Ctx.getRegisterInfo();
+    unsigned FrameReg = GetFrameReg(Ctx, Out);
+    if (MRI && FrameReg != X86::NoRegister) {
----------------
eugenis wrote:
> ygorshenin wrote:
> > eugenis wrote:
> > > This is shadowing X86AsmInstrumentation::FrameReg. Confusing.
> > > Perhaps rename the other one to smth like "InitialFrameReg"?
> > That's why I moved FrameReg to the private part of the X86AsmInstrumentation and there're no shadowing. But if you still insisting I'll rename X86AsmInstrumentation::FrameReg to something like InitialFrameReg.
> Yes, please rename.
> 
Done.

================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:850
@@ -837,1 +849,3 @@
 
+unsigned X86AsmInstrumentation::GetFrameRegGeneric(const MCContext &Ctx,
+                                                   MCStreamer &Out) {
----------------
ygorshenin wrote:
> eugenis wrote:
> > Please check (and test) that all this stuff works with -fno-unwind-tables.
> Sure, but could you please explain what -fno-unwind-tables does?
Done in http://reviews.llvm.org/D5547.

================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:868
@@ +867,3 @@
+  // If CFA register is not specified explicitly, let's assume that it's SP.
+  if (!Frame.CfaRegister)
+    return X86::RSP;
----------------
eugenis wrote:
> ygorshenin wrote:
> > eugenis wrote:
> > > Is it even possible? Can we CHECK instead?
> > > Is it the same situation as "No active dwarf frame" above?
> > MCDwarfFrameInfo::CfaRegister is set when something like .cfi_def_cfa_register was emitted. Otherwise it won't be set (even between .cfi_startproc and .cfi_endproc).
> And this makes MCDwarfFrameInfo::CfaRegister unreliable, which is not so good.
> There are target-dependent initial CFI instructions, see MCAsmInfo::addInitialFrameState. Could you make CfaRegister take them into account?
> 
Done.

http://reviews.llvm.org/D5520






More information about the llvm-commits mailing list