[PATCH] D50180: [Sanitizers] Libasan failed to be build with -mthumb and -fno-omit-frame-pointer by GCC
Denis Khalikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 5 03:31:00 PDT 2018
denis13 updated this revision to Diff 164003.
https://reviews.llvm.org/D50180
Files:
lib/sanitizer_common/sanitizer_linux.cc
Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -1597,7 +1597,10 @@
register int *r2 __asm__("r2") = parent_tidptr;
register void *r3 __asm__("r3") = newtls;
register int *r4 __asm__("r4") = child_tidptr;
- register int r7 __asm__("r7") = __NR_clone;
+ // GCC does not allow to have frame pointer register as a clobber register
+ // for inline assembler, when flag -fno-omit-frame-pointer is added. By
+ // default, arm with mthumb mode uses r7 as a frame pointer register.
+ register int r8 __asm__("r8") = __NR_clone;
#if __ARM_ARCH > 4 || defined (__ARM_ARCH_4T__)
# define ARCH_HAS_BX
@@ -1627,6 +1630,8 @@
/* Do the system call */
"swi 0x0\n"
+ "push {r7}\n"
+ "mov r7, r8\n"
/* if (%r0 != 0)
* return %r0;
@@ -1642,9 +1647,10 @@
"mov r7, %7\n"
"swi 0x0\n"
"1:\n"
+ "pop {r7}\n"
"mov %0, r0\n"
: "=r"(res)
- : "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r7),
+ : "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r8),
"i"(__NR_exit)
: "memory");
return res;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50180.164003.patch
Type: text/x-patch
Size: 1529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180905/006b483b/attachment.bin>
More information about the llvm-commits
mailing list