[PATCH] [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.
Yuri Gorshenin
ygorshenin at chromium.org
Wed Oct 8 08:02:34 PDT 2014
PTAL
================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:302
@@ -307,2 +301,3 @@
- virtual void StoreFlags(MCStreamer &Out) override {
+ virtual void StoreReg(MCStreamer &Out, unsigned Reg) {
+ EmitInstruction(Out, MCInstBuilder(X86::PUSH32r).addReg(Reg));
----------------
eugenis wrote:
> I think the common term is "spill".
Done.
================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:707
@@ +706,3 @@
+
+ void ComputeMemOperandAddress(X86Operand &Op, unsigned Reg, MCContext &Ctx,
+ MCStreamer &Out) {
----------------
eugenis wrote:
> I wonder if this could be moved to the parent class to reduce code duplication.
Done.
================
Comment at: test/Instrumentation/AddressSanitizer/X86/asm_rsp_mem_op.s:12
@@ +11,3 @@
+# CHECK: leaq 8(%rsp), %rdi
+# CHECK-NEXT: leaq 152(%rdi), %rdi
+# CHECK: callq __asan_report_load8 at PLT
----------------
eugenis wrote:
> This could be done with 1 lea instruction.
It significantly complicates an algorithm, but done.
http://reviews.llvm.org/D5599
More information about the llvm-commits
mailing list