summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rw-r--r--debian/control5
-rw-r--r--debian/control.m41
-rw-r--r--debian/patches/kfreebsd-unwind.diff226
-rw-r--r--debian/rules.patch1
5 files changed, 234 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 900c51d..3c1585f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,9 @@ gcc-4.8 (4.8.1-3) UNRELEASED; urgency=low
* Update the Linaro support to the 4.8-2013.06 release.
* Fix cross building a native compiler.
* Work around dh_shlibdeps not working on target libraries (see #698881).
+ * Add build dependency on kfreebsd-kernel-headers (>= 0.84) [kfreebsd-any].
+ * Add handling for unwind inside signal trampoline for kfreebsd (Petr
+ Salinger). Closes: #712016.
[ Iain Buclaw ]
* Update gdc to 20130610.
diff --git a/debian/control b/debian/control
index 3733c78..e798cc9 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,7 @@ Build-Depends: debhelper (>= 5.0.62), g++-multilib [amd64 i386 kfreebsd-amd64 mi
libc6.1-dev (>= 2.13-5) [alpha ia64] | libc0.3-dev (>= 2.13-5) [hurd-i386] | libc0.1-dev (>= 2.13-5) [kfreebsd-i386 kfreebsd-amd64] | libc6-dev (>= 2.13-5), libc6-dev (>= 2.13-31) [armel armhf],
libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc1 [amd64 ppc64 kfreebsd-amd64 s390x x32], libn32gcc1 [mips mipsel], lib64gcc1 [i386 mips mipsel powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel], libc6-dev-mipsn32 [mips mipsel], libc6-dev-x32 [amd64 i386], libx32gcc1 [amd64 i386],
libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-i386] | libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64] | libc6-dbg,
+ kfreebsd-kernel-headers (>= 0.84) [kfreebsd-any],
m4, libtool, autoconf2.64,
libunwind7-dev (>= 0.98.5-6) [ia64], libatomic-ops-dev [ia64],
zlib1g-dev, gawk, lzma, xz-utils, patchutils,
@@ -1778,7 +1779,7 @@ Description: GNU D compiler (version 2), based on the GCC backend
This compiler supports D language version 2.
Package: libphobos-4.8-dev
-Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386
+Architecture: amd64 i386 x32 kfreebsd-amd64 kfreebsd-i386
Section: libdevel
Priority: optional
Depends: zlib1g-dev, ${shlibs:Depends}, ${misc:Depends}
@@ -1789,7 +1790,7 @@ Description: Phobos D standard library
Package: libphobos-4.8-dbg
Section: debug
-Architecture: amd64 i386 kfreebsd-amd64 kfreebsd-i386
+Architecture: amd64 i386 x32 kfreebsd-amd64 kfreebsd-i386
Priority: extra
Depends: gdc-4.8 (= ${gdc:Version}), libphobos-4.8-dev (= ${gdc:Version}), ${misc:Depends}
Provides: libphobos-dbg
diff --git a/debian/control.m4 b/debian/control.m4
index 91ef2b8..b3d35d5 100644
--- a/debian/control.m4
+++ b/debian/control.m4
@@ -64,6 +64,7 @@ Build-Depends: debhelper (>= 5.0.62), GCC_MULTILIB_BUILD_DEP
LIBC_BUILD_DEP,
LIBC_BIARCH_BUILD_DEP
LIBC_DBG_DEP
+ kfreebsd-kernel-headers (>= 0.84) [kfreebsd-any],
AUTO_BUILD_DEP AUTOGEN_BUILD_DEP
libunwind7-dev (>= 0.98.5-6) [ia64], libatomic-ops-dev [ia64],
zlib1g-dev, gawk, lzma, xz-utils, patchutils,
diff --git a/debian/patches/kfreebsd-unwind.diff b/debian/patches/kfreebsd-unwind.diff
new file mode 100644
index 0000000..e9c4ac4
--- /dev/null
+++ b/debian/patches/kfreebsd-unwind.diff
@@ -0,0 +1,226 @@
+#
+# unwinding via signal trampoline
+#
+--- a/src/libgcc/config.host
++++ b/src/libgcc/config.host
+@@ -523,7 +523,12 @@
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
+ md_unwind_header=i386/linux-unwind.h
+ ;;
+-i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
++i[34567]86-*-kfreebsd*-gnu)
++ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
++ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
++ md_unwind_header=i386/freebsd-unwind.h
++ ;;
++i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
+ ;;
+@@ -532,7 +537,12 @@
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
+ md_unwind_header=i386/linux-unwind.h
+ ;;
+-x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
++x86_64-*-kfreebsd*-gnu)
++ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
++ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
++ md_unwind_header=i386/freebsd-unwind.h
++ ;;
++x86_64-*-knetbsd*-gnu)
+ extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+ tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
+ ;;
+--- a/src/libgcc/config/i386/freebsd-unwind.h
++++ b/src/libgcc/config/i386/freebsd-unwind.h
+@@ -0,0 +1,190 @@
++/* DWARF2 EH unwinding support for AMD x86-64 and x86.
++ Copyright (C) 2004-2013 Free Software Foundation, Inc.
++
++This file is part of GCC.
++
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++Under Section 7 of GPL version 3, you are granted additional
++permissions described in the GCC Runtime Library Exception, version
++3.1, as published by the Free Software Foundation.
++
++You should have received a copy of the GNU General Public License and
++a copy of the GCC Runtime Library Exception along with this program;
++see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
++<http://www.gnu.org/licenses/>. */
++
++/* Do code reading to identify a signal frame, and set the frame
++ state data appropriately. See unwind-dw2.c for the structs.
++ Don't use this at all if inhibit_libc is used. */
++
++#ifndef inhibit_libc
++
++#include <signal.h>
++#include <sys/ucontext.h>
++#include <machine/sigframe.h>
++
++#ifdef __x86_64__
++
++#define MD_FALLBACK_FRAME_STATE_FOR x86_64_fb_fallback_frame_state
++
++static _Unwind_Reason_Code
++x86_64_fb_fallback_frame_state (struct _Unwind_Context *context,
++ _Unwind_FrameState *fs)
++{
++ unsigned int *pc = context->ra;
++ struct sigframe *sf;
++ long new_cfa;
++
++/* sys/amd64/amd64/sigtramp.S:
++
++ 48 8d 7c 24 10 lea 0x10(%rsp),%rdi
++ 6a 00 pushq $0x0
++ 48 c7 c0 a1 01 00 00 mov $0x1a1,%rax
++ 0f 05 syscall
++*/
++
++ if ( (pc[0] == 0x247c8d48U)
++ && (pc[1] == 0x48006a10U)
++ && (pc[2] == 0x01a1c0c7U)
++ && (pc[3] == 0x050f0000U))
++ {
++ sf = (struct sigframe *) context->cfa;
++ }
++ else
++ return _URC_END_OF_STACK;
++
++ new_cfa = sf->sf_uc.uc_mcontext.mc_rsp;
++ fs->regs.cfa_how = CFA_REG_OFFSET;
++ /* Register 7 is rsp */
++ fs->regs.cfa_reg = 7;
++ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
++
++ /* The SVR4 register numbering macros aren't usable in libgcc. */
++ fs->regs.reg[0].how = REG_SAVED_OFFSET;
++ fs->regs.reg[0].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rax - new_cfa;
++ fs->regs.reg[1].how = REG_SAVED_OFFSET;
++ fs->regs.reg[1].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rdx - new_cfa;
++ fs->regs.reg[2].how = REG_SAVED_OFFSET;
++ fs->regs.reg[2].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rcx - new_cfa;
++ fs->regs.reg[3].how = REG_SAVED_OFFSET;
++ fs->regs.reg[3].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rbx - new_cfa;
++ fs->regs.reg[4].how = REG_SAVED_OFFSET;
++ fs->regs.reg[4].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rsi - new_cfa;
++ fs->regs.reg[5].how = REG_SAVED_OFFSET;
++ fs->regs.reg[5].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rdi - new_cfa;
++ fs->regs.reg[6].how = REG_SAVED_OFFSET;
++ fs->regs.reg[6].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rbp - new_cfa;
++ fs->regs.reg[8].how = REG_SAVED_OFFSET;
++ fs->regs.reg[8].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r8 - new_cfa;
++ fs->regs.reg[9].how = REG_SAVED_OFFSET;
++ fs->regs.reg[9].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r9 - new_cfa;
++ fs->regs.reg[10].how = REG_SAVED_OFFSET;
++ fs->regs.reg[10].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r10 - new_cfa;
++ fs->regs.reg[11].how = REG_SAVED_OFFSET;
++ fs->regs.reg[11].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r11 - new_cfa;
++ fs->regs.reg[12].how = REG_SAVED_OFFSET;
++ fs->regs.reg[12].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r12 - new_cfa;
++ fs->regs.reg[13].how = REG_SAVED_OFFSET;
++ fs->regs.reg[13].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r13 - new_cfa;
++ fs->regs.reg[14].how = REG_SAVED_OFFSET;
++ fs->regs.reg[14].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r14 - new_cfa;
++ fs->regs.reg[15].how = REG_SAVED_OFFSET;
++ fs->regs.reg[15].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_r15 - new_cfa;
++ fs->regs.reg[16].how = REG_SAVED_OFFSET;
++ fs->regs.reg[16].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_rip - new_cfa;
++ fs->retaddr_column = 16;
++ fs->signal_frame = 1;
++ return _URC_NO_REASON;
++}
++
++#else /* ifdef __x86_64__ */
++
++#define MD_FALLBACK_FRAME_STATE_FOR x86_fb_fallback_frame_state
++
++static _Unwind_Reason_Code
++x86_fb_fallback_frame_state (struct _Unwind_Context *context,
++ _Unwind_FrameState *fs)
++{
++ unsigned int *pc = context->ra;
++ struct sigframe *sf;
++ long new_cfa;
++
++/* sys/amd64/ia32/ia32_sigtramp.S
++
++ 8d 44 24 20 lea 0x20(%esp),%eax
++ 50 push %eax
++ b8 a1 01 00 00 mov $0x1a1,%eax
++ 50 push %eax
++ cd 80 int $0x80
++ eb fe jmp -
++*/
++
++/* sys/i386/i386/locore.s: sigcode()
++
++ 8d 44 24 20 lea 0x20(%esp),%eax
++ 50 push %eax
++ f7 40 54 00 00 02 00 testl $0x20000,0x54(%eax)
++ 75 03 jne +
++ 8e 68 14 mov 0x14(%eax),%gs
++ b8 a1 01 00 00 mov $0x1a1,%eax
++ 50 push %eax
++ cd 80 int $0x80
++ eb fe jmp -
++*/
++
++ if ((pc[0] == 0x2024448dU)
++ && ((
++ (pc[1] == 0x01a1b850U)
++ && (pc[2] == 0xcd500000U)
++ && ((pc[3] & 0xFF) == 0x80)
++ )
++
++ || (
++ (pc[4] == 0x01a1b814U)
++ && (pc[5] == 0xcd500000U)
++ && ((pc[6] & 0xFF) == 0x80)
++ )))
++ {
++ sf = (struct sigframe *) context->cfa;
++ }
++ else
++ return _URC_END_OF_STACK;
++
++ new_cfa = sf->sf_uc.uc_mcontext.mc_esp;
++ fs->regs.cfa_how = CFA_REG_OFFSET;
++ fs->regs.cfa_reg = 4;
++ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
++
++ /* The SVR4 register numbering macros aren't usable in libgcc. */
++ fs->regs.reg[0].how = REG_SAVED_OFFSET;
++ fs->regs.reg[0].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_eax - new_cfa;
++ fs->regs.reg[3].how = REG_SAVED_OFFSET;
++ fs->regs.reg[3].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_ebx - new_cfa;
++ fs->regs.reg[1].how = REG_SAVED_OFFSET;
++ fs->regs.reg[1].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_ecx - new_cfa;
++ fs->regs.reg[2].how = REG_SAVED_OFFSET;
++ fs->regs.reg[2].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_edx - new_cfa;
++ fs->regs.reg[6].how = REG_SAVED_OFFSET;
++ fs->regs.reg[6].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_esi - new_cfa;
++ fs->regs.reg[7].how = REG_SAVED_OFFSET;
++ fs->regs.reg[7].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_edi - new_cfa;
++ fs->regs.reg[5].how = REG_SAVED_OFFSET;
++ fs->regs.reg[5].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_ebp - new_cfa;
++ fs->regs.reg[8].how = REG_SAVED_OFFSET;
++ fs->regs.reg[8].loc.offset = (long)&sf->sf_uc.uc_mcontext.mc_eip - new_cfa;
++ fs->retaddr_column = 8;
++ fs->signal_frame = 1;
++ return _URC_NO_REASON;
++}
++
++#endif /* ifdef __x86_64__ */
++#endif /* ifdef inhibit_libc */
diff --git a/debian/rules.patch b/debian/rules.patch
index 48e1e31..19175c7 100644
--- a/debian/rules.patch
+++ b/debian/rules.patch
@@ -82,6 +82,7 @@ debian_patches += \
libgo-setcontext-config \
pr57211 \
gcc-auto-build \
+ kfreebsd-unwind \
# $(if $(filter yes, $(DEB_CROSS)),,gcc-print-file-name) \
# libstdc++-nothumb-check \