--- coregrind/m_trampoline.S.orig
+++ coregrind/m_trampoline.S
@@ -939,6 +939,64 @@
 #	undef UD2_1024
 #	undef UD2_PAGE
 
+/*---------------- x86-openbsd ----------------*/
+#else
+#if defined(VGP_x86_openbsd)
+
+.global VG_(trampoline_stuff_start)
+VG_(trampoline_stuff_start):
+
+.global VG_(x86_openbsd_SUBST_FOR_sigreturn)
+VG_(x86_openbsd_SUBST_FOR_sigreturn):
+	lea	0x14(%esp), %eax	/* args to sigreturn(ucontext_t *) */
+	pushl	%eax
+	pushl	%eax			/* fake return addr */
+/*	movl	0x44(%eax), %gs	; restore %gs, not done by sigreturn */
+        movl    $__NR_fake_sigreturn, %eax
+        int     $0x80
+        ud2
+
+.global VG_(trampoline_stuff_end)
+VG_(trampoline_stuff_end):
+
+#else
+#if defined(VGP_amd64_openbsd)
+
+#	define UD2_16     ud2 ; ud2 ; ud2 ; ud2 ;ud2 ; ud2 ; ud2 ; ud2
+#	define UD2_64     UD2_16   ; UD2_16   ; UD2_16   ; UD2_16
+#	define UD2_256    UD2_64   ; UD2_64   ; UD2_64   ; UD2_64
+#	define UD2_1024   UD2_256  ; UD2_256  ; UD2_256  ; UD2_256
+#	define UD2_PAGE   UD2_1024 ; UD2_1024 ; UD2_1024 ; UD2_1024
+
+	/* a leading page of unexecutable code */
+	UD2_PAGE
+
+.global VG_(trampoline_stuff_start)
+VG_(trampoline_stuff_start):
+
+.global VG_(amd64_openbsd_SUBST_FOR_sigreturn)
+VG_(amd64_openbsd_SUBST_FOR_sigreturn):
+        /* This is a very specific sequence which GDB uses to
+           recognize signal handler frames. */
+        movq    $__NR_fake_sigreturn, %rax
+        movq	%rsp, %rdi
+        addq	$40, %rdi
+        syscall
+        ud2
+
+.global VG_(trampoline_stuff_end)
+VG_(trampoline_stuff_end):
+
+	/* and a trailing page of unexecutable code */
+	UD2_PAGE
+
+#	undef UD2_16
+#	undef UD2_64
+#	undef UD2_256
+#	undef UD2_1024
+#	undef UD2_PAGE
+
+
 /*---------------- x86-darwin ----------------*/
 #else
 #if defined(VGP_x86_darwin)
@@ -1703,6 +1761,8 @@
 #else
 #  error Unknown platform
 
+#endif
+#endif
 #endif
 #endif
 #endif
