summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-07-09 07:05:48 +0000
committerguenther <guenther@openbsd.org>2014-07-09 07:05:48 +0000
commitf976e3e3ecf74c9656cae4411c12123b73a67ece (patch)
treeeb217d01997719192757598972e7aca7dc1acc07
parentformat string should be a string literal. (diff)
downloadwireguard-openbsd-f976e3e3ecf74c9656cae4411c12123b73a67ece.tar.xz
wireguard-openbsd-f976e3e3ecf74c9656cae4411c12123b73a67ece.zip
Fix backtraces through _dl_bind_start by adding dwarf annotations for
the stack adjustments/handling in the asm. Based on FreeBSD. ok kettenis@ matthew@
-rw-r--r--libexec/ld.so/amd64/ldasm.S47
1 files changed, 46 insertions, 1 deletions
diff --git a/libexec/ld.so/amd64/ldasm.S b/libexec/ld.so/amd64/ldasm.S
index 19e703f750f..c1556c39ddb 100644
--- a/libexec/ld.so/amd64/ldasm.S
+++ b/libexec/ld.so/amd64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.15 2014/07/06 07:28:36 otto Exp $ */
+/* $OpenBSD: ldasm.S,v 1.16 2014/07/09 07:05:48 guenther Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
@@ -98,6 +98,7 @@ DL_SYSCALL(lstat)
DL_SYSCALL(utrace)
DL_SYSCALL(getentropy)
DL_SYSCALL2(getcwd,__getcwd)
+DL_SYSCALL2(set_tcb,__set_tcb)
DL_SYSCALL2(_syscall,__syscall)
DL_SYSCALL2(sysctl,__sysctl)
@@ -128,16 +129,38 @@ _dl_sigprocmask:
.global _dl_bind_start
.type _dl_bind_start,@function
_dl_bind_start:
+ .cfi_startproc
+ .cfi_adjust_cfa_offset 16
pushfq # save registers
+ .cfi_adjust_cfa_offset 8
+ /*.cfi_offset %rflags, -16 */
pushq %rax
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %rax, -24
pushq %rcx
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %rcx, -32
pushq %rdx
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %rdx, -40
pushq %rsi
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %rsi, -48
pushq %rdi
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %rdi, -56
pushq %r8
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %r8, -64
pushq %r9
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %r9, -72
pushq %r10
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %r10, -80
pushq %r11
+ .cfi_adjust_cfa_offset 8
+ .cfi_offset %r11, -88
movq 80(%rsp), %rdi # Copy of reloff
movq 88(%rsp), %rsi # Copy of obj
@@ -145,16 +168,38 @@ _dl_bind_start:
movq %rax,88(%rsp) # Store function to be called in obj
popq %r11 # restore registers
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %r11
popq %r10
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %r10
popq %r9
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %r9
popq %r8
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %r8
popq %rdi
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %rdi
popq %rsi
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %rsi
popq %rdx
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %rdx
popq %rcx
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %rcx
popq %rax
+ .cfi_adjust_cfa_offset -8
+ .cfi_restore %rax
popfq
+ .cfi_adjust_cfa_offset -8
+ /*.cfi_restore %rflags */
leaq 8(%rsp),%rsp # Discard reloff, do not change eflags
+ .cfi_adjust_cfa_offset -8
ret
+ .cfi_endproc