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

Evgeniy Stepanov eugenis at google.com
Tue Sep 30 00:51:14 PDT 2014


Please don't forget about a compiler-rt test (either in this or in a separate commit).

================
Comment at: lib/MC/MCStreamer.cpp:278
@@ -277,2 +277,3 @@
   CurFrame->Instructions.push_back(Instruction);
+  CurFrame->CfaRegister = static_cast<unsigned>(Register);
 }
----------------
What about MCStreamer::EmitCFIDefCfa?

================
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) {
----------------
This is shadowing X86AsmInstrumentation::FrameReg. Confusing.
Perhaps rename the other one to smth like "InitialFrameReg"?

================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:850
@@ -837,1 +849,3 @@
 
+unsigned X86AsmInstrumentation::GetFrameRegGeneric(const MCContext &Ctx,
+                                                   MCStreamer &Out) {
----------------
Please check (and test) that all this stuff works with -fno-unwind-tables.

================
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;
----------------
Is it even possible? Can we CHECK instead?
Is it the same situation as "No active dwarf frame" above?

================
Comment at: test/Instrumentation/AddressSanitizer/X86/asm_cfi.s:1
@@ +1,2 @@
+# RUN: llvm-mc %s -triple=i386-unknown-linux-gnu -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
+
----------------
Please add at least a one-line comment on what this test is about.

http://reviews.llvm.org/D5520






More information about the llvm-commits mailing list