[sanitizer] Do not break the CFI unwind chain in clone().
authorSergey Matveev <earthdok@google.com>
Tue, 8 Oct 2013 16:38:39 +0000 (16:38 +0000)
committerSergey Matveev <earthdok@google.com>
Tue, 8 Oct 2013 16:38:39 +0000 (16:38 +0000)
Fixes build on clang 3.2, which doesn't support cfi_undefined. This change
doesn't seem to break the slow unwinder. Even if it does, the worst thing that
could happen is that we would not see a backtrace when a fatal error happens
under StopTheWorld.

llvm-svn: 192196

compiler-rt/lib/sanitizer_common/sanitizer_linux.cc

index 10c112a..c1390ff 100644 (file)
@@ -787,7 +787,6 @@ uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
                         */
                        "movq   %6,%%r8\n"
                        "movq   %7,%%r10\n"
-                       ".cfi_endproc\n"
                        "syscall\n"
 
                        /* if (%rax != 0)
@@ -797,8 +796,9 @@ uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
                        "jnz    1f\n"
 
                        /* In the child. Terminate unwind chain. */
-                       ".cfi_startproc\n"
-                       ".cfi_undefined %%rip;\n"
+                       // XXX: We should also terminate the CFI unwind chain
+                       // here. Unfortunately clang 3.2 doesn't support the
+                       // necessary CFI directives, so we skip that part.
                        "xorq   %%rbp,%%rbp\n"
 
                        /* Call "fn(arg)". */