diff options
author | andreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-21 20:12:16 +0000 |
---|---|---|
committer | andreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-21 20:12:16 +0000 |
commit | bdd1ee48c90b02a388514bc4337c6636817a34a7 (patch) | |
tree | cbc102cde16bd74e962539de9fe1795e92371b68 /libgcc | |
parent | 0c8e6bdd921c1df3860fa7a17ed4f63c18d39f09 (diff) | |
download | gcc-bdd1ee48c90b02a388514bc4337c6636817a34a7.tar.gz |
2012-03-21 Andreas Tobler <andreast@fgznet.ch>
* config.host: Add bits to support powerpc64-*-freebsd*.
* config/rs6000/freebsd-unwind.h: New file.
* config/rs6000/t-freebsd64: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185614 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 6 | ||||
-rw-r--r-- | libgcc/config.host | 10 | ||||
-rw-r--r-- | libgcc/config/rs6000/freebsd-unwind.h | 69 | ||||
-rw-r--r-- | libgcc/config/rs6000/t-freebsd64 | 5 |
4 files changed, 88 insertions, 2 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 11379bb7626..c4a34f60f88 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2012-03-21 Andreas Tobler <andreast@fgznet.ch> + + * config.host: Add bits to support powerpc64-*-freebsd*. + * config/rs6000/freebsd-unwind.h: New file. + * config/rs6000/t-freebsd64: New file. + 2012-03-20 Richard Guenther <rguenther@suse.de> PR gcov-profile/52627 diff --git a/libgcc/config.host b/libgcc/config.host index 4a0897c2515..1e815181802 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -830,9 +830,15 @@ powerpc64-*-darwin*) tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble" extra_parts="$extra_parts crt2.o" ;; -powerpc-*-freebsd*) - tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp t-slibgcc-libgcc" +powerpc*-*-freebsd*) + tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-freebsd t-softfp-sfdf t-softfp-excl t-softfp" extra_parts="$extra_parts crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o" + case ${host} in + powerpc64*) + tmake_file="${tmake_file} rs6000/t-freebsd64" + md_unwind_header=rs6000/freebsd-unwind.h + ;; + esac ;; powerpc-*-netbsd*) tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff" diff --git a/libgcc/config/rs6000/freebsd-unwind.h b/libgcc/config/rs6000/freebsd-unwind.h new file mode 100644 index 00000000000..3bdedff94bf --- /dev/null +++ b/libgcc/config/rs6000/freebsd-unwind.h @@ -0,0 +1,69 @@ +/* DWARF2 EH unwinding support for PowerPC64 FreeBSD. + Copyright (C) 2012 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/>. */ + +#define R_LR 65 + +#define MD_FROB_UPDATE_CONTEXT frob_update_context + +static void +frob_update_context (struct _Unwind_Context *context, + _Unwind_FrameState *fs ATTRIBUTE_UNUSED) +{ + const unsigned int *pc = (const unsigned int *) context->ra; + +#ifdef __powerpc64__ + if (fs->regs.reg[2].how == REG_UNSAVED) + { + /* If the current unwind info (FS) does not contain explicit info + saving R2, then we have to do a minor amount of code reading to + figure out if it was saved. The big problem here is that the + code that does the save/restore is generated by the linker, so + we have no good way to determine at compile time what to do. */ + if (pc[0] == 0xF8410028 + || ((pc[0] & 0xFFFF0000) == 0x3D820000 + && pc[1] == 0xF8410028)) + { + /* We are in a plt call stub or r2 adjusting long branch stub, + before r2 has been saved. Keep REG_UNSAVED. */ + } + else + { + unsigned int *insn + = (unsigned int *) _Unwind_GetGR (context, R_LR); + if (insn && *insn == 0xE8410028) + _Unwind_SetGRPtr (context, 2, context->cfa + 40); + else if (pc[0] == 0x4E800421 + && pc[1] == 0xE8410028) + { + /* We are at the bctrl instruction in a call via function + pointer. gcc always emits the load of the new R2 just + before the bctrl so this is the first and only place + we need to use the stored R2. */ + _Unwind_Word sp = _Unwind_GetGR (context, 1); + _Unwind_SetGRPtr (context, 2, (void *)(sp + 40)); + } + } + } +#endif +} diff --git a/libgcc/config/rs6000/t-freebsd64 b/libgcc/config/rs6000/t-freebsd64 new file mode 100644 index 00000000000..5dc0d489535 --- /dev/null +++ b/libgcc/config/rs6000/t-freebsd64 @@ -0,0 +1,5 @@ +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc +SHLIB_MAPFILES = libgcc-std.ver + +softfp_wrap_start := '\#ifndef __powerpc64__' +softfp_wrap_end := '\#endif' |