summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaddy <naddy@openbsd.org>2017-06-04 14:20:12 +0000
committernaddy <naddy@openbsd.org>2017-06-04 14:20:12 +0000
commitf60b60f590c8e215ff99a9465a76d928b84aee2b (patch)
tree00456dbe2682ce881153405f44ba0ae080fcdddc
parentSplit early startup code out of locore.S into locore0.S. Adjust link (diff)
downloadwireguard-openbsd-f60b60f590c8e215ff99a9465a76d928b84aee2b.tar.xz
wireguard-openbsd-f60b60f590c8e215ff99a9465a76d928b84aee2b.zip
For the memory operand, clang passes in an address relative to the
stack pointer. We cannot use this twice while pushing values on the stack. Instead load the operand address into a register and use this as base address. Use %edx since it is already marked as clobbered. Also fixes a syntax problem for clang. ok mlarkin@
-rw-r--r--libexec/ld.so/i386/rtld_machine.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c
index 027a7a389cc..4390b0d7ce9 100644
--- a/libexec/ld.so/i386/rtld_machine.c
+++ b/libexec/ld.so/i386/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.36 2017/01/24 07:48:37 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.37 2017/06/04 14:20:12 naddy Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -397,7 +397,8 @@ _dl_bind(elf_object_t *object, int index)
{
register long syscall_num __asm("eax") = SYS_kbind;
- __asm volatile("pushl 4 %3; pushl %3; pushl %2; pushl %1;"
+ __asm volatile("lea %3, %%edx; pushl 4(%%edx);"
+ " pushl (%%edx); pushl %2; pushl %1;"
" push %%eax; int $0x80; addl $20, %%esp" :
"+a" (syscall_num) : "r" (&buf), "i" (sizeof(buf)),
"m" (cookie) : "edx", "cc", "memory");