diff options
author | Chih-Hung Hsieh <chh@google.com> | 2016-08-24 19:59:10 -0700 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2016-09-01 13:04:18 -0700 |
commit | 606dc24d662e27c783daca114ecd35b4f345ff93 (patch) | |
tree | 7abfc78deed199148d3ee88d384bb2e213623251 /coregrind/m_syswrap | |
parent | 170e6a100bb171c574b51f5ac75bfc10b7497fbd (diff) | |
download | valgrind-606dc24d662e27c783daca114ecd35b4f345ff93.tar.gz |
Make host valgrind work with clang/llvm.
Bug: 28454823
* Add -fno-builtin-memset flag.
Bug: 31035712
* Make esp 16-byte aligned before calling x86 functions.
Bug: https://bugs.kde.org/show_bug.cgi?id=368120
Note that this does not fix other errors on x86 emulator.
Change-Id: Ibc19d0902aaba68edbb9f3758da368c35294128b
Test: Run valgrind on linux host and arm/x86 targets.
Test: In art run "mm valgrind-test-art-host"
Diffstat (limited to 'coregrind/m_syswrap')
-rw-r--r-- | coregrind/m_syswrap/syswrap-x86-linux.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 24d7dc18a..233886d2f 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -83,8 +83,9 @@ asm( ".globl vgModuleLocal_call_on_new_stack_0_1\n" "vgModuleLocal_call_on_new_stack_0_1:\n" " movl %esp, %esi\n" // remember old stack pointer -" movl 4(%esi), %esp\n" // set stack -" pushl 16(%esi)\n" // arg1 to stack +" movl 4(%esi), %esp\n" // set stack, assume %esp is now 16-byte aligned +" subl $12, %esp\n" // skip 12 bytes +" pushl 16(%esi)\n" // arg1 to stack, %esp is 16-byte aligned " pushl 8(%esi)\n" // retaddr to stack " pushl 12(%esi)\n" // f to stack " movl $0, %eax\n" // zero all GP regs @@ -150,7 +151,8 @@ asm( " movl 4+"FSZ"(%esp), %ecx\n" /* syscall arg2: child stack */ " movl 12+"FSZ"(%esp), %ebx\n" /* fn arg */ " movl 0+"FSZ"(%esp), %eax\n" /* fn */ -" lea -8(%ecx), %ecx\n" /* make space on stack */ +" andl $-16, %ecx\n" /* align to 16-byte */ +" lea -20(%ecx), %ecx\n" /* allocate 16*n+4 bytes on stack */ " movl %ebx, 4(%ecx)\n" /* fn arg */ " movl %eax, 0(%ecx)\n" /* fn */ @@ -165,7 +167,7 @@ asm( " jnz 1f\n" /* CHILD - call thread function */ -" popl %eax\n" +" popl %eax\n" /* child %esp is 16-byte aligned */ " call *%eax\n" /* call fn */ /* exit with result */ |