diff options
author | Andreas Tobler <andreast@fgznet.ch> | 2012-03-21 21:12:16 +0100 |
---|---|---|
committer | Andreas Tobler <andreast@gcc.gnu.org> | 2012-03-21 21:12:16 +0100 |
commit | d82ad50db3dcf1a7fd7dabae129bf4ee6dc771fd (patch) | |
tree | cbc102cde16bd74e962539de9fe1795e92371b68 /libgcc/config | |
parent | f4e017c4b169ec8833d38905710cd53e3b08639e (diff) | |
download | gcc-d82ad50db3dcf1a7fd7dabae129bf4ee6dc771fd.zip gcc-d82ad50db3dcf1a7fd7dabae129bf4ee6dc771fd.tar.gz gcc-d82ad50db3dcf1a7fd7dabae129bf4ee6dc771fd.tar.bz2 |
config.host: Add bits to support powerpc64-*-freebsd*.
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.
From-SVN: r185614
Diffstat (limited to 'libgcc/config')
-rw-r--r-- | libgcc/config/rs6000/freebsd-unwind.h | 69 | ||||
-rw-r--r-- | libgcc/config/rs6000/t-freebsd64 | 5 |
2 files changed, 74 insertions, 0 deletions
diff --git a/libgcc/config/rs6000/freebsd-unwind.h b/libgcc/config/rs6000/freebsd-unwind.h new file mode 100644 index 0000000..3bdedff --- /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 0000000..5dc0d48 --- /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' |